Promises? #1164
Replies: 3 comments
-
Posted at 2018-02-08 by @gfwilliams It's built-in to all the new firmwares: http://www.espruino.com/Reference#Promise I guess you're using ESP8266 so I'm not sure if you're using a build that has it disabled or something, but on an official board with up to date firmware then it's just already there as soon as you type |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-05-20 by user90002 I try use promise, but it's work strange:
output:
Bolded text printed, because reject called after resolve, but promise must be ignore change state at second call. And what about async\await? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-05-21 by @gfwilliams
This looks like a bug - I've filed one for the issue here: espruino/Espruino#1433 Looks like we didn't test for that as all code I've seen to date just calls one of the other - not both.
No, they're not implemented on Espruino. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-02-08 by espftw
I saw an old thread referencing Promises, but can't seem to find an official Promise module anywhere. I tried an implementation by @favo from this thread but a simple
console.log()
test had erroneous results where callbacks occurred before resolutions.Trying to save a bit of time myself and hoping this was already implemented.
Beta Was this translation helpful? Give feedback.
All reactions