mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat: split globals to support smaller worker chuncks
This commit is contained in:
25
tns-core-modules/globals/core/globals-core.ts
Normal file
25
tns-core-modules/globals/core/globals-core.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
// Required by TypeScript compiler
|
||||
import "../ts-helpers";
|
||||
|
||||
import "../register-module-helpers";
|
||||
|
||||
// This method iterates all the keys in the source exports object and copies them to the destination exports one.
|
||||
// Note: the method will not check for naming collisions and will override any already existing entries in the destination exports.
|
||||
global.moduleMerge = function (sourceExports: any, destExports: any) {
|
||||
for (let key in sourceExports) {
|
||||
destExports[key] = sourceExports[key];
|
||||
}
|
||||
};
|
||||
|
||||
global.zonedCallback = function (callback: Function): Function {
|
||||
if ((<any>global).zone) {
|
||||
// Zone v0.5.* style callback wrapping
|
||||
return (<any>global).zone.bind(callback);
|
||||
}
|
||||
if ((<any>global).Zone) {
|
||||
// Zone v0.6.* style callback wrapping
|
||||
return (<any>global).Zone.current.wrap(callback);
|
||||
} else {
|
||||
return callback;
|
||||
}
|
||||
};
|
||||
5
tns-core-modules/globals/core/package.json
Normal file
5
tns-core-modules/globals/core/package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name" : "core",
|
||||
"main" : "globals-core",
|
||||
"nativescript": {}
|
||||
}
|
||||
Reference in New Issue
Block a user