You get the latest numbered build, like 1v89, but then you get builds from GitHub - which have the fixes in as I make them. Currently there aren't automatic Puck.js builds though.
I think the problem is that when you enter code in the root scope, it's executed statement by statement.
Promise 1 is executed and resolves, as does Promise 2, then you call Promise.all.
In 1v89, Promise.all sits there waiting for the 2 promises to complete (when they have already completed) - in later versions I check to see if they have previously executed, and if so execute the .all immediately.
In 1v89, just wrapping it in a function would probably make it work:
function go() {
var p1 = Promise.resolve(1).then(function () {
console.log('p1');
});
var p2 = Promise.resolve(2).then(function () {
console.log('p2');
});
var all = Promise.all([p1, p2]).then(function () {
console.log('done');
}).catch(function () {
console.log('FAIL');
});
console.log('Promise test');
}
go();
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.
You get the latest numbered build, like 1v89, but then you get builds from GitHub - which have the fixes in as I make them. Currently there aren't automatic Puck.js builds though.
I think the problem is that when you enter code in the root scope, it's executed statement by statement.
Promise 1 is executed and resolves, as does Promise 2, then you call
Promise.all
.In 1v89,
Promise.all
sits there waiting for the 2 promises to complete (when they have already completed) - in later versions I check to see if they have previously executed, and if so execute the.all
immediately.In 1v89, just wrapping it in a function would probably make it work: