GitHub · npm · Edit this page
Syntax only
This plugin only allows Babel to parse this syntax. If you want to transform it then see async-generator-functions and transform-regenerator if generator support is not supported natively.
Syntax
async function* agf() {
await 1;
}
async function f() {
for await (let x of y) {
g(x);
}
}
npm install --save-dev babel-plugin-syntax-async-generators
.babelrc
(Recommended).babelrc
{
"plugins": ["syntax-async-generators"]
}
babel --plugins syntax-async-generators script.js
require("babel-core").transform("code", {
plugins: ["syntax-async-generators"]
});