1 | # regenerator-runtime
|
2 |
|
3 | Standalone runtime for
|
4 | [Regenerator](https://github.com/facebook/regenerator)-compiled generator
|
5 | and `async` functions.
|
6 |
|
7 | To import the runtime as a module (recommended), either of the following
|
8 | import styles will work:
|
9 | ```js
|
10 | // CommonJS
|
11 | const regeneratorRuntime = require("regenerator-runtime");
|
12 |
|
13 | // ECMAScript 2015
|
14 | import regeneratorRuntime from "regenerator-runtime";
|
15 | ```
|
16 |
|
17 | To ensure that `regeneratorRuntime` is defined globally, either of the
|
18 | following styles will work:
|
19 | ```js
|
20 | // CommonJS
|
21 | require("regenerator-runtime/runtime");
|
22 |
|
23 | // ECMAScript 2015
|
24 | import "regenerator-runtime/runtime.js";
|
25 | ```
|
26 |
|
27 | To get the absolute file system path of `runtime.js`, evaluate the
|
28 | following expression:
|
29 | ```js
|
30 | require("regenerator-runtime/path").path
|
31 | ```
|