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.
Following
How to use async/await with axios in react
I am trying to make a simple get request to my server using Async/Await in a React.js App.
The server loads a simple JSON at /data which looks like this
JSON
{
id: 1,
name: "Aditya"
}
I…
I have been playing around with the feature in an SPA using TypeScript and native Promises, and I notice that even if I refactor a long-running function into an async function returning a promise, the UI is still unresponsive.
So my questions…
Regarding compatibility between ECMAScript specification and actual implementation;
It is fairly easy to check out the data about browser support for ECMAScript2015 (ES6), but I found it pretty difficult to have an equivalently clear table for all…
Is it safe to use async-await in Javascript instead of
generators-promises now, knowing that the syntax has not made yet and
will be coming with the release of ES8?
What browsers can I count on it being available, and how common are the browsers…
I haven't seen these constructs used much but I've found myself writing them to make use of async / await in functions that wouldn't typically return a promise, for example
chan.consume(queue, (msg) => {
this.pendingMsgs++; // executed…
How can I change the following code so that both async operations are triggered and given an opportunity to run concurrently?
const value1 = await getValue1Async();
const value2 = await getValue2Async();
// use both values
Do I need to do something…
I was experimenting with how / is interpreted when around different keywords and operators, and found that the following syntax is perfectly legal:
// awaiting something that isn't a Promise is fine, it's just strange to do:
const foo = await…
I have a hard time understanding how async and await works behind the scenes. I know we have promises which make our non blocking code by using the "then" function we can place all the work we need to do after the promise is resolved. and the work…
I would like to add support to async/await to node repl
Following this issue: https://github.com/nodejs/node/issues/8382
I've tried to use this one https://github.com/paulserraino/babel-repl but it is missing async await suppport
I would like to use…
I'm new in ES7
I want to use async/await in Vue.js
Here is my code
created (){
this.getA()
console.log(2)
this.getB()
},
methods : {
getA (){
console.log(1)
},
getB (){
console.log(3)
}
}
It returns…
Appreciating that firebase has added support for promises, is there a way to run a query like the following inside of an async function?:
const eventref = this.db.ref('cats/whiskers');
const value = await eventref.once('value')
Running the above…
Actually my main question was using Promise.prototype.catch() in async/await ES8 syntax, Undoubtedly Promise.prototype.then() is existed in essence of async/await syntax.
I searched about using Promise.prototype.catch() in async/await and found…
In an async function, I can get an asynchronous value like so:
const foo = await myAsyncFunction()
If I want to call a method on the result, with a sync function I'd do something like myAsyncFunction().somethingElse()
Is it possible to chain calls…
Basically, function must be prefixed with async keyword if await used inside it. But if some function just returns Promise and doesn't awaiting for anything, should I mark the function as async?
Seems like both correct or not?
// with async (returns…