Use this tag for questions about features finalized in ECMAScript 2017. Do *not* use this tag if the code in question merely *uses* one of the features, *unless* the feature is cause of the problem.
I am confused about the current discussion of adding async functions and the keyword await to the next EcmaScript.
I do not understand why it is necessary to have the async keyword before the function keyword.
From my point of view the await keyword…
Await is a amazing feature in es7.
However,everytime I use await I found that I have to define a async function and call this function.
Such as
async function asy(){
const [resCityGuess,resCityHot,resCityAll]=await Promise.all([
…
I had a asynchronous function in Javascript and I added setTimeout to it. The code looks like that:
let timer;
clearTimeout(timer);
timer =setTimeout(() => {
(async() => {
await this._doSomething();
…
This proposal suggests that async functions can use generator functions under the hood, although I cannot find a confirmation of this in ES2017 spec.
Moreover, when generator prototype becomes messed up in Chrome/Node.js, async functions don't seem…
I started to use ES7 feature async/await , which gives the best approach to deal with asynchronous tasks, and makes your code cleaner and readable.
However it doesn't give you an access to Promise, created by async function, so if you do some async…
I'm trying to code a method that show recursively an ActionSheetIOS to select a value contained from arrays and return the selected values:
async function _rescursiveSelect(data, index) {
if (index < data.length) {
const object =…
My function returns a promise that resolves as soon as the HTTP server starts. This is my code:
function start() {
return new Promise((resolve, reject) {
this.server = Http.createServer(app);
this.server.listen(port, () => {
…
I'm learning react-native, and I'm running into an issue. Why does getting data on return from an async function return a promise, but in the async function itself, it correctly returns an array of objects?
On componentDidMount(), I call my async…
I'm currently trying to use async/await for a function that requires the loop to be synchronous.
This is the function:
async channelList(resolve, reject) {
let query = ['channellist'].join(' ');
this.query.exec(query)
.then(response =>…
So i'm using express.js and looking into using async/await with node 7. Is there a way that I can still catch errors but get rid of the try/catch block? Perhaps a function wrapper? I'm not sure how this would actually execute the function's code and…
In node.js, I have a database transaction, where I want to call an async method in then callback, but I get error message the keyword 'await' is reserved.
This is async saveImage function:
const saveImage = async (parsedLink) => {
…
The ECMAScript specification defines the Atomics object in the section 24.4.
Among all the global objects this is the more obscure for me since I didn't know about its existence until I didn't read its specification, and also Google hasn't many…
I know that doing this:
const resultA = await a()
const resultB = await b()
// code here
Is effectively
a().then( resultA => {
b().then( resultB => {
// code here
})
})
Basically, a() runs then b() runs. I nested them to show that both…
I am targeting ES2018 and do not care about ES3 or ES5. From my tsconfig.json: "target": "ES2018". tsc complains:
An async function or method in ES5/ES3 requires the 'Promise' constructor. Make
sure you have a declaration for the 'Promise'…