Skip to content

Commit 76e6689

Browse files
committed
Register TypeScript helpers at the very start
1 parent ff71e6e commit 76e6689

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

tns-core-modules/globals/globals.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
// This method iterates all the keys in the source exports object and copies them to the destination exports one.
1+
// Required by TypeScript compiler
2+
require("./decorators");
3+
4+
// Required by V8 snapshot generator
5+
global.__extends = global.__extends || function (d, b) {
6+
for (var p in b) {
7+
if (b.hasOwnProperty(p)) {
8+
d[p] = b[p];
9+
}
10+
}
11+
function __() { this.constructor = d; }
12+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13+
};
14+
15+
// This method iterates all the keys in the source exports object and copies them to the destination exports one.
216
// Note: the method will not check for naming collisions and will override any already existing entries in the destination exports.
317
global.moduleMerge = function (sourceExports: any, destExports: any) {
418
for (var key in sourceExports) {
@@ -44,16 +58,6 @@ global.zonedCallback = function (callback: Function): Function {
4458
}
4559
}
4660

47-
global.__extends = global.__extends || function (d, b) {
48-
for (var p in b) {
49-
if (b.hasOwnProperty(p)) {
50-
d[p] = b[p];
51-
}
52-
}
53-
function __() { this.constructor = d; }
54-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
55-
};
56-
5761
global.registerModule("timer", () => require("timer"));
5862
global.registerModule("ui/dialogs", () => require("ui/dialogs"));
5963
global.registerModule("xhr", () => require("xhr"));
@@ -128,8 +132,6 @@ if (platform.device.os === platform.platformNames.android) {
128132
global.console.dump = function (args) { c.dump(args); };
129133
}
130134

131-
require("./decorators");
132-
133135
export function Deprecated(target: Object, key?: string | symbol, descriptor?: any) {
134136
if (descriptor) {
135137
var originalMethod = descriptor.value;

0 commit comments

Comments
 (0)