Re:Allora – Use promises on any JavaScript object
by c-smile on Monday July 18, 2016 @08:21PM
(#12118755)
So what does this
mean exactly? How many times the foo() will be called? And how to stop that interval?
[ Parent
| on HN ]
Re:Allora – Use promises on any JavaScript object
by gianlucaguarini on Tuesday July 19, 2016 @12:56AM
(#12119791)
foo will be called only once (see my answer above). I am working on another script to achieve event streams using es6 generators let's keep in touch
Re:Allora – Use promises on any JavaScript object
by egeozcan on Tuesday July 19, 2016 @07:44AM
(#12121139)
promisifiedWindow.setInterval(200).then(x => console.log("res:", x));
-> Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}
>> VM310:1 res: undefined
How do you cancel the interval?
Re:Allora – Use promises on any JavaScript object
by gianlucaguarini on Tuesday July 19, 2016 @08:45AM
(#12121380)
Ok with this it should be possible https://github.com/GianlucaGuarini/allora/pull/3
Re:Allora – Use promises on any JavaScript object
by gianlucaguarini on Tuesday July 19, 2016 @07:51AM
(#12121168)
At moment it's not possible and it does not make any sense to use a setInterval with a promise in return. But I will think about a simple solution to clear the timer functions