Thanks, the PROMISE is available on the 8266 and does work mostly. I would like to create the promise here:
wifi.on('connected',(details) => {
var clearQueuePromise = new Promise((resolve,reject) => { --http stuff-- }
});
However, that blows up with nothing in the way of useful information. If I just create the promise outside of the wifi.on, and let it fail until the WiFi connection completes it does what I want although a bit messy.
var clearQueuePromise = new Promise((resolve,reject) => {
idClearQueue = setInterval(() => {
idClearQueue = setInterval(() => {
--do http GET until successful---
clearInterval(idClearQueue);
resolve("OK");
},2000);
});
And then
wifi.on('connected', (details) => {
clearQueuePromise.then((resolve,reject) => {
print('clear queue finished');
});
// This initiates the main loop
idMainLoop = setInterval(mainLoop, 2000);
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Thanks, the PROMISE is available on the 8266 and does work mostly. I would like to create the promise here:
However, that blows up with nothing in the way of useful information. If I just create the promise outside of the wifi.on, and let it fail until the WiFi connection completes it does what I want although a bit messy.
And then
Critical comments are welcome :-)