8000 Add a simple polyfil for System.import so we can use some Angular ser… · ArduinoMinas/NativeScript@011be36 · GitHub
[go: up one dir, main page]

Skip to content

Commit 011be36

Browse files
Add a simple polyfil for System.import so we can use some Angular services out-of-the-box (NativeScript#5042)
1 parent 65a50bb commit 011be36

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tns-core-modules/globals/globals.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ global.registerModule("ui/dialogs", () => require("ui/dialogs"));
7070
global.registerModule("xhr", () => require("xhr"));
7171
global.registerModule("fetch", () => require("fetch"));
7272

73+
(<any>global).System = {
74+
import(path) {
75+
return new Promise((resolve, reject) => {
76+
try {
77+
resolve(global.require(path));
78+
} catch(e) {
79+
reject(e);
80+
}
81+
});
82+
}
83+
}
84+
7385
const __tnsGlobalMergedModules = new Map<string, boolean>();
7486

7587
function registerOnGlobalContext(name: string, module: string): void {

0 commit comments

Comments
 (0)
0