![]() The async/await feature lets the code explicitly wait for a promise to settle (resolve or reject).We also use arrow functions in the definition of the sleep function. Promises, a native feature of ES2015 (aka ES6).Two new JavaScript features (as of 2017) helped write this "sleep" function: wait, but note that most browsers will not allow it on the browser's main thread. If you do want a blocking construct, see this answer using Atomics. This means it does not block the execution of the rest of the script, which is what you want in the vast majority of the cases. ![]()
0 Comments
Leave a Reply. |