1 |
3a515b92
|
cagy
|
/**
|
2 |
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
3 |
|
|
*
|
4 |
|
|
* This source code is licensed under the MIT license found in the
|
5 |
|
|
* LICENSE file in the root directory of this source tree.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
// This method of obtaining a reference to the global object needs to be
|
9 |
|
|
// kept identical to the way it is obtained in runtime.js
|
10 |
|
|
var g = (function() { return this })() || Function("return this")();
|
11 |
|
|
|
12 |
|
|
// Use `getOwnPropertyNames` because not all browsers support calling
|
13 |
|
|
// `hasOwnProperty` on the global `self` object in a worker. See #183.
|
14 |
|
|
var hadRuntime = g.regeneratorRuntime &&
|
15 |
|
|
Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
|
16 |
|
|
|
17 |
|
|
// Save the old regeneratorRuntime in case it needs to be restored later.
|
18 |
|
|
var oldRuntime = hadRuntime && g.regeneratorRuntime;
|
19 |
|
|
|
20 |
|
|
// Force reevalutation of runtime.js.
|
21 |
|
|
g.regeneratorRuntime = undefined;
|
22 |
|
|
|
23 |
|
|
module.exports = require("./runtime");
|
24 |
|
|
|
25 |
|
|
if (hadRuntime) {
|
26 |
|
|
// Restore the original runtime.
|
27 |
|
|
g.regeneratorRuntime = oldRuntime;
|
28 |
|
|
} else {
|
29 |
|
|
// Remove the global property added by runtime.js.
|
30 |
|
|
try {
|
31 |
|
|
delete g.regeneratorRuntime;
|
32 |
|
|
} catch(e) {
|
33 |
|
|
g.regeneratorRuntime = undefined;
|
34 |
|
|
}
|
35 |
|
|
}
|