async/await #1169
Replies: 6 comments
-
Posted at 2018-06-19 by @gfwilliams This was actually mentioned on the Espruino wishlist and there's a more in-depth discussion here: espruino/Espruino#1272 Unfortunately due to the way Espruino executes JavaScript it is particularly difficult to implement async/await. A very limited implementation (no support for FOR/WHILE/TRY..CATCH/SWITCH/etc) wouldn't be as bad, but I think it would end up being frustrating to use. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-06-19 by @gniezen Ah, thanks! I'll remember to check the GitHub issues first in future ;) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-06-19 by @gfwilliams
Honestly I'd prefer people asked on the forum rather than creating GitHub issues :) Basically it's something I'd like to add - and which seems to be really popular - but at the moment it is very tricky to handle properly so I'd be surprised if it got done this year :( |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-06-19 by Wilberforce Can you use babel? Using a random googled input:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-06-19 by @gniezen @wilberforce I noticed in the GitHub issue that Gordon linked to above that there are a few Babel examples. Yes, I think that will work just fine for now, thanks! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2018-06-19 by @gfwilliams Sorry, I totally forgot to add transpiling as an option. If you use the I'm still a bit iffy about pulling the whole of Babel into the Web IDE, but if there are web services that can publicly be used I'm very happy to add an option to those to it? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-06-19 by @gniezen
Any chance that Espruino will supports ES6's async/await syntax in future?
I've found that it is easier to use and much more readable than using Promises with .then, or callbacks for that matter. It is very much suited to the asynchronous nature of connected devices, where you typically send a command and then wait for reply.
Beta Was this translation helpful? Give feedback.
All reactions