Merge pull request #2484 from NativeScript/jasssonpet/snapshot-ts-helpers

[Snapshot] Register TypeScript helpers at the very start
This commit is contained in:
Vasil Chimev
2016-07-22 14:36:38 +03:00
committed by GitHub

View File

@ -1,4 +1,18 @@
// This method iterates all the keys in the source exports object and copies them to the destination exports one.
// Required by TypeScript compiler
require("./decorators");
// Required by V8 snapshot generator
global.__extends = global.__extends || function (d, b) {
for (var p in b) {
if (b.hasOwnProperty(p)) {
d[p] = b[p];
}
}
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
// 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 (var key in sourceExports) {
@ -44,16 +58,6 @@ global.zonedCallback = function (callback: Function): Function {
}
}
global.__extends = global.__extends || function (d, b) {
for (var p in b) {
if (b.hasOwnProperty(p)) {
d[p] = b[p];
}
}
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
global.registerModule("timer", () => require("timer"));
global.registerModule("ui/dialogs", () => require("ui/dialogs"));
global.registerModule("xhr", () => require("xhr"));
@ -128,8 +132,6 @@ if (platform.device.os === platform.platformNames.android) {
global.console.dump = function (args) { c.dump(args); };
}
require("./decorators");
export function Deprecated(target: Object, key?: string | symbol, descriptor?: any) {
if (descriptor) {
var originalMethod = descriptor.value;