Permalink
Fetching contributors…
Cannot retrieve contributors at this time
61 lines (43 sloc) 851 Bytes
---
id: babel-plugin-syntax-async-generators
title: @babel/plugin-syntax-async-generators
sidebar_label: syntax-async-generators
---

Example

Syntax

async function* agf() {
  await 1;
}
async function f() {
  for await (let x of y) {
    g(x);
  }
}

Installation

npm install --save-dev @babel/plugin-syntax-async-generators

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["@babel/plugin-syntax-async-generators"]
}

Via CLI

babel --plugins @babel/plugin-syntax-async-generators script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["@babel/plugin-syntax-async-generators"]
});

References