ecmascript-2017 Questions

2

I've seen a lot of articles about how use async/await in your unit tests, but my need is the opposite. How do you write a test for a method that uses async/await? My spec is not able to reach any...
Cheddar asked 19/1, 2018 at 17:45

1

Solved

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 ...
Bucentaur asked 9/1, 2018 at 16:32

1

Solved

I would love to use Javascript ES6 and ES7 syntax (especially async/await, my new best friends) without transpiling. Is that even an option? And should it be an option? It all depends on the sub-q...

1

Solved

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...
Brewer asked 1/5, 2017 at 0:17

1

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...

1

Solved

The MDN documentation for async function currently gives the following combined example of two ways to use await. I've reordered it just a bit for emphasis: function resolveAfter2Seconds(x) { ret...
Byyourleave asked 31/10, 2017 at 23:39

2

Solved

Since await does not work inside Array.map or Array.reduce, can you do something like the following or would this be considered misuse of Promise.all? Normally, neo4j.session() would be awaited. /...
Tench asked 25/10, 2017 at 20:34

2

Solved

const ret = () => new Promise(resolve => setTimeout( () => resolve('somestring'), 1000)); async function wrapper() { let someString = await ret(); return someString; } console.log( wra...
Suds asked 1/10, 2016 at 23:38

1

Solved

I'm compiling my javascript files with Laravel mix, and as I am not very knowledgeable yet on Babel and package.json, I want to ask if Laravel Mix supports ES8, especially async/await? If I try it...
Depurative asked 26/8, 2017 at 11:19

2

Solved

As title, how can I detect async/await es7 support in browser? Is that possible?
Incise asked 9/9, 2017 at 4:3

2

Solved

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,...
Overmaster asked 22/8, 2017 at 9:31

3

Solved

I just came to the painful realization that generator functions cannot be used with await. Only promises or async functions. My team built an entire application with all modules consisting of gene...
Boaz asked 10/1, 2017 at 22:6

2

I'm using the native fetch library as specified here. It seems that whenever a response other than a 200 OK is returned it throws an exception with the string response Uncaught (in promise) TypeErr...
Salchunas asked 11/7, 2017 at 1:48

1

The issue I'm curious if it would be possible to consume a generator-function in async/await context within modern ES2017. (The application is a React-native-application) This is my code where I...
Diversification asked 18/6, 2017 at 10:1

1

How can I catch the geolocation specific error to notify the user that they must have geolocation turned on? The catch logs an error called PositionError as referenced here in the Mozilla docs "h...
Epithet asked 8/6, 2017 at 6:12

1

Solved

I keep getting a SyntaxError: Unexpected token )' error for the following code: passport.use( 'local-signup', new LocalStrategy({ usernameField: 'email', passwordField: 'password', passReqToC...
Spade asked 4/6, 2017 at 13:48

2

Solved

I creating an object that uses async function methods with babel-polyfill/babel-preset-es2017, however I am having a problem with this: let obj = () => { return { doAsync: async () =&gt...
Barmen asked 23/5, 2017 at 19:35

2

Solved

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(...
Urbanism asked 18/5, 2017 at 2:27

1

Solved

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 cor...

1

I'm working on a TypeScript project and we're using ES2017 as the output target, as well as one of the libs, because it'll then go through Babel, and we want to support the latest feature set for w...
Archpriest asked 22/3, 2017 at 15:38

1

Solved

Consider the following case: const waitForEvent = async (api) => { api.on('eventOne', () => { return 'eventOne'; }) api.on('eventTwo', () => { return 'eventTwo'; }) api.on('eve...
Stinkweed asked 2/5, 2017 at 20:59

1

Solved

Im using the async function inside the object to send a response in express.js Controller Code : module.exports = { async signUpEmail(req, res) { /** * @description Parameters from body * @...
Brisling asked 22/4, 2017 at 20:25

1

Solved

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 wo...
Germinate asked 9/4, 2017 at 2:58

1

Solved

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(' ');...
Archambault asked 7/4, 2017 at 23:44

2

Solved

I have a slew of async functions I'm using and I'm having a weird issue. My code, working, looks like: async mainAsyncFunc (metadata) { let files = metadata.map(data => this.anotherAsyncFunc(...
Paraffinic asked 3/4, 2017 at 20:51

© 2022 - 2024 — McMap. All rights reserved.