You are reading a single comment by @nhlives and its replies. Click here to read the full conversation.
  • Copying your code together this would be the code not working, right?

    wifi.on('connected',(details) => {
        var clearQueuePromise = new Promise((resolve,reject) => {
          idClearQueue = setInterval(() => {
               idClearQueue = setInterval(() => {
                   --do http GET until successful---
                  clearInterval(idClearQueue);
                 resolve("OK");
               },2000);
        });
        clearQueuePromise.then((resolve,reject) => { print('clear queue finished'); });
    });
    

    And having the exact same promise definition "var clearQueuePromise =" outside of the "wifi.on('connected')" makes it work?

  • I didn't explore this too much but yes the above code is what I had originally tried. When running it I got some error (can't remember exactly) like "lost prompt" and then nothing.

    Having it outside fails to connect to the web site until the WiFi is connected but otherwise works.

About

Avatar for nhlives @nhlives started