forked from microsoft/TypeScript
/
dynamicImportWithNestedThis_es2015.js
38 lines (35 loc) · 1.15 KB
/
dynamicImportWithNestedThis_es2015.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//// [dynamicImportWithNestedThis_es2015.ts]
// https://github.com/Microsoft/TypeScript/issues/17564
class C {
private _path = './other';
dynamic() {
return import(this._path);
}
}
const c = new C();
c.dynamic();
//// [dynamicImportWithNestedThis_es2015.js]
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
// https://github.com/Microsoft/TypeScript/issues/17564
class C {
constructor() {
this._path = './other';
}
dynamic() {
var _a, _b;
return _a = this._path, __syncRequire ? (_b = _a, Promise.resolve().then(() => require(_b))) : new Promise((resolve_1, reject_1) => { require([_a], resolve_1, reject_1); });
}
}
const c = new C();
c.dynamic();
});