You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The await operator is used to wait for a Promise and get its fulfillment value. It can only be used inside an async function or at the top level of a module.
Await is useful for calling and waiting for results from remote services and code readability.
Since ECMAScript 4 proposed generators without using a * prefix in function names unlike in ECMAScript Harmony, I suggest, please... maybe do not introduce the async modifier and comply with ECMAScript 4?
Not that it's difficult to parse, but it'd be nice to have a general consensus in the syntax, since ActionScript 3.0 implements most of ECMAScript 4.
ES4 examples:
/* methodThatYields(): Iterator.<Number> */
function methodThatYields(): Number {
for (var i = 0; i < 10; i++) {
yield i
}
}
function asynchronousMethod1(): Promise.<Number> (
Promise.resolve(10)
);
function asynchronousMethod2(): Promise.<Number> {
return await asynchronousMethod1();
}
I've an implementation of Promise in my repository, as well (based on a polyfill), but I added a simple type parameter, so you may want to look at agera.util instead.
The description from MDN:
The await operator is used to wait for a Promise and get its fulfillment value. It can only be used inside an async function or at the top level of a module.
Await is useful for calling and waiting for results from remote services and code readability.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#top_level_await
The text was updated successfully, but these errors were encountered: