Open rkumorek opened 5 years ago
For Babel v7.x.x install fast-async@7 - although I haven't used it for over a year when Babel7 was in beta - it's possible they've changed the plugin API since it was written
The code basically runs for me. You can see it working (without Babel) here:
Thanks for response. I do have issue when using ky. It stops executing on this for...of loop https://github.com/sindresorhus/ky/blob/master/index.js#L226 and https://github.com/sindresorhus/ky/blob/master/index.js#L319
It is pretty much the same as our examples so I am not sure why would it fail. Any ideas? Also after some more testing I had other async for...of loops working... except of ky loops.
// EDIT:
Oh my. I've been using fast-async 6.3. Upgraded to @7 and it works. Yay! Thanks for help and for fast-async :) You can close the issue.
Well, tried it again and after transpiling ky
I still can't get it working on IE11 :( Guess I won't be able to use that package yet.
IE 11 doesn't have promises, so you might need to include a promise polyfill to get this to work in IE11.
Hey,
I am running into an issue when I write for...of loop with await. ([example](http://nodent.mailed.me.uk/#async%20function%20tellYouLater(sayWhat)%20%7B%0A%20%20%20%20%2F%2F%20Do%20something%20asynchronous%2C%20such%20as%20DB%20access%2C%20web%20access%2C%20etc.%0A%20%20%20%20return%20%22I%20said%3A%20%22%2BsayWhat%3B%0A%7D%0A%0Aconst%20hooks%20%3D%20%5B%0A%20%20%20%20function()%20%7B%0A%20%20%20%20%20%20%20%20const%20reminder%20%3D%20tellYouLater(%22I'll%20tell%20you%20later%22)%0A%20%20%20%20%20%20%20%20return%20reminder%3B%0A%20%20%20%20%7D%2C%20%20%20%20%0A%20%20%20%20function()%20%7B%0A%20%20%20%20%20%20%20%20const%20reminder%20%3D%20tellYouLater(%22Eat%20more%20salad%22)%0A%20%20%20%20%20%20%20%20return%20reminder%3B%0A%20%20%20%20%7D%20%20%20%20%0A%5D%0A%0Afor%20(const%20hook%20of%20hooks)%20%7B%0A%20%20%20%20console.log(await%20hook())%3B%0A%7D%0A%0A~options~%7B%22mode%22%3A%22lazyThenables%22%2C%22promiseType%22%3A%22native%22%2C%22noRuntime%22%3Afalse%2C%22es6target%22%3Afalse%2C%22wrapAwait%22%3Afalse%2C%22spec%22%3Afalse%7D)). I am transpiling to ES5 with babel and I believe I need
nodent-runtime
to have that code running. When I adduseRuntimeModule: true
to babel config I get this error:[dev:build] Error: This API has been removed. If you're looking for this functionality in Babel 7, you should import the '@babel/helper-module-imports' module and use the functions exposed from that module, such as 'addNamed' or 'addDefault'.
I've tried adding
@babel/helper-module-imports
but couldn't make it work, not sure exactly how should I use it ;( Is there a way I can make it work with fast-async and babel 7?Edit: What I just found out is it runs those async functions in the loop but anything that's after the loop not invoked. :/