mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Add a simple polyfil for System.import so we can use some Angular services out-of-the-box (#5042)
This commit is contained in:
@@ -70,6 +70,18 @@ global.registerModule("ui/dialogs", () => require("ui/dialogs"));
|
||||
global.registerModule("xhr", () => require("xhr"));
|
||||
global.registerModule("fetch", () => require("fetch"));
|
||||
|
||||
(<any>global).System = {
|
||||
import(path) {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
resolve(global.require(path));
|
||||
} catch(e) {
|
||||
reject(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const __tnsGlobalMergedModules = new Map<string, boolean>();
|
||||
|
||||
function registerOnGlobalContext(name: string, module: string): void {
|
||||
|
||||
Reference in New Issue
Block a user