Make typings compatible with @types/node.

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.
This commit is contained in:
Hristo Deshev
2017-02-14 17:40:25 +02:00
parent 3056ce51c2
commit 86481cce4a
25 changed files with 238 additions and 307 deletions

View File

@@ -1,7 +1,7 @@
import * as application from "application";
declare var CACurrentMediaTime;
global.time = function(): number {
(<any>global).time = function(): number {
if (global.android) {
return java.lang.System.nanoTime() / 1000000; // 1 ms = 1000000 ns
}
@@ -10,4 +10,4 @@ global.time = function(): number {
}
}
application.start({ moduleName: "css-perf-test/root" });
application.start({ moduleName: "css-perf-test/root" });

View File

@@ -2,6 +2,6 @@
export function navigatedTo(args: ObservableEventData) {
setTimeout(() => {
console.log(`Time: ${global.time() - global.startTime} ms`);
console.log(`Time: ${(<any>global).time() - (<any>global).startTime} ms`);
});
}
}

View File

@@ -1,7 +1,7 @@
import {Page} from "ui/page";
export function onTap(args: any) {
global.startTime = global.time();
(<any>global).startTime = (<any>global).time();
let page = <Page>args.object.page;
page.frame.navigate("css-perf-test/main-page");
}
}