Allora – Use promises on any JavaScript object
1–10 of 25 posts
Re: Allora – Use promises on any JavaScript object
#2Re: Allora – Use promises on any JavaScript object
#3Re: Allora – Use promises on any JavaScript object
#4It uses Proxy and Promise classes.
Re: Allora – Use promises on any JavaScript object
#5Re: Allora – Use promises on any JavaScript object
#6Thus promisifying of window.setInterval() and window.requestAnimationFrame() is very questionable.
The same applies to possibly repeatable .onXXXX() methods.
2.2.2 If onFulfilled is a function:
...
2.2.2.3 it must not be called more than once.
https://promisesaplus.com/Re: Allora – Use promises on any JavaScript object
#7Re: Allora – Use promises on any JavaScript object
#8It is not possible to fulfill promise more than once. Thus promisifying of window.setInterval() and window.requestAnimationFrame() is very questionable. The same applies to possibly repeatable .onXXXX() methods. 2.2.2 If onFulfilled is a function: ... 2.2.2.3 it must not be called more than once. https://promisesaplus.com/
Re: Allora – Use promises on any JavaScript object
#9It is not possible to fulfill promise more than once. Thus promisifying of window.setInterval() and window.requestAnimationFrame() is very questionable. The same applies to possibly repeatable .onXXXX() methods. 2.2.2 If onFulfilled is a function: ... 2.2.2.3 it must not be called more than once. https://promisesaplus.com/
But a Promise.all method, while outside the A+ spec, conventionally returns a promise for the resolution of all promises in the array passed as an argument; if all those promises are fulfilled, so will be the promise returned by .all, while if any of them is rejected, so will be the etc., etc.
So the browser example given in the Allora Github readme is perfectly reasonable. It's the exact same kind of thing you do when, for example, you need to await the completion of multiple separate HTTP requests in order to do something with all of their results. While, again, .all isn't part of the A+ standard, this is perfectly conventional and unremarkable behavior; not only is it unsurprising to see in a library like this one, it would be exceptional in its absence if it weren't there.
That said, I would be curious to see Allora compared with, for example, Bluebird's "promisifyAll" method, which appears to do much the same thing.
Re: Allora – Use promises on any JavaScript object
#10It is not possible to fulfill promise more than once. Thus promisifying of window.setInterval() and window.requestAnimationFrame() is very questionable. The same applies to possibly repeatable .onXXXX() methods. 2.2.2 If onFulfilled is a function: ... 2.2.2.3 it must not be called more than once. https://promisesaplus.com/
It's not possible to fulfill a promise more than once, no. But a Promise.all method, while outside the A+ spec, conventionally returns a promise for the resolution of all promises in the array passed as an argument; if all those promises are fulfilled, so will be the promise returned by .all, while if any of them is rejected, so will be the etc., etc. So the browser example given in the Allora Github readme is perfec…
thatWindow.setInterval(100).then( foo )
mean exactly? How many times the foo() will be called? And how to stop that interval?