mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-20 15:34:26 +08:00

Fixes name clashes and uses Node-compatible typings where possible. Changes: - setTimout et al now return NodeJS.Timer instead of number - No "console" module anymore. Everyone uses it through global.console anyway. - We have a typed "global" instance with exposed properties now. Any "freeform" accesses must go through a `(<any>global).blah` cast. - remove tns-core-modules.{base,es6,es2015}.d.ts. Those were needed as workarounds for the ES6/DOM/Node type clashes.
33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
if (typeof (<any>global).__decorate !== "function") {
|
|
(<any>global).__decorate = function (decorators, target, key, desc) {
|
|
var c = arguments.length;
|
|
var r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
|
|
if (typeof (<any>global).Reflect === "object" && typeof (<any>global).Reflect.decorate === "function") {
|
|
r = (<any>global).Reflect.decorate(decorators, target, key, desc);
|
|
}
|
|
else {
|
|
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
if (d = decorators[i]) {
|
|
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
}
|
|
}
|
|
}
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
}
|
|
}
|
|
|
|
if (typeof (<any>global).__metadata !== "function") {
|
|
(<any>global).__metadata = function (k, v) {
|
|
if (typeof (<any>global).Reflect === "object" && typeof (<any>global).Reflect.metadata === "function") {
|
|
return (<any>global).Reflect.metadata(k, v);
|
|
}
|
|
};
|
|
}
|
|
|
|
if (typeof (<any>global).__param !== "function") {
|
|
(<any>global).__param = (global && (<any>global).__param) || function (paramIndex, decorator) {
|
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
};
|
|
}
|