From 76e6689a4270fead21fe01e677073787c94d486b Mon Sep 17 00:00:00 2001 From: Jason Zhekov Date: Thu, 21 Jul 2016 12:18:02 +0300 Subject: [PATCH] Register TypeScript helpers at the very start --- tns-core-modules/globals/globals.ts | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tns-core-modules/globals/globals.ts b/tns-core-modules/globals/globals.ts index 294759638..7a46cde14 100644 --- a/tns-core-modules/globals/globals.ts +++ b/tns-core-modules/globals/globals.ts @@ -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;