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've been researching what the possible values of the lib property mean in the compilerOptions found within the tsconfig.json file. I found on the Typescript GitHub page the relevant d.ts files corresponding to those values and apparently by using…
I have a function chain in a node 4.3 script that looks something like, callback -> promise -> async/await -> async/await -> async/await
like so:
const topLevel = (resolve, reject) => {
const foo = doThing(data)
.then(results => {
…
I'm trying to log a statement in an async function as follows:
async generateCharts (insights) {
const { url } = await this.reportsClient.createReport(insights)
console.log('url from reports', url)
return this.parse(url)
}
Log statement…
I have create a class in nodejs
class ApnService {
sendNotification(deviceType, deviceToken, msg, type, id) {
try {
const note = await apnProvider.send(note, deviceToken)
console.log(note)
} catch (err) {
…
I started using async/await ES7 functions in my js applications (transpiled by Babel).
Correct me if wrong, but do they work only with Promises? If yes, this means that I need to wrap regular callback functions into Promises (what I'm currently…
I successfully check user's authentication state with onAuthStateChange observer and redirect user to the Dashboard page (react-native project). However, on the dashboard I already want to show some user specific data, e.g. enrolled…
Is there a way to use the TypeScript compiler only to remove type annotations, but not transpiling async functions? Something like a { target: 'esInfinite' } option? The reason is: There are browsers that already support async functions, so I wish…
I have two async functions. Both of them are waiting for two 3 seconds function calls. But the second one is faster than the first. I think the faster one is running in parallel and other in serial. Is my assumption correct? If yes, why is this…
I have a method which returns a value from an element in the array. Not all the elements have the property I want to return. I would like to do this function with one line using the method find(). I've tried this way to solve it:…
I use babel-eslint to lint/fix my code. Worked great until I wanted to adopt some ES2017 async await found overhere.
I changed my React app accordingly, allbeit slightly different:
The relevant part of my index.js:
async function renderApp() {
…
I read about async/await, but I've a critical question.
At first I explain an old example to show base of my question and then I ask my exact question.
Everybody know it:
console.log('1');
console.log('2');
console.log('3'); // Ex: 123
It is simple…
I've just started to experiment with classes and async await. I'm using Node version 8.9.0 (LTS). When I console.log(this), I get undefined instead of the reference to the object.
subhandler.js
class Handler {
constructor(props) {
…
I'm trying to fetch data from an API that only returns 1000 items per call, and I want to do this recursively until I have all the data.
I don't know beforehand how many items there are in total, so after every call I have to check
If the call was…