diff --git a/Application/application_common.ts b/Application/application_common.ts index 69b3413da..f6833c4d9 100644 --- a/Application/application_common.ts +++ b/Application/application_common.ts @@ -1,7 +1,4 @@ -import consoleModule = require("Console/console"); - -// TODO: This is put in the global context, is this the preferred approach -console = new consoleModule.Console(); +require("globals"); export var onLaunch = function (): any { } diff --git a/Console/console.ts b/Console/console.ts index 6eef3df08..42421a1dc 100644 --- a/Console/console.ts +++ b/Console/console.ts @@ -278,7 +278,7 @@ export class Console { } public log(message: any, ...formatParams: any[]): void { - helperModule.log(this.formatParams.apply(this, arguments)); + helperModule.helper_log(this.formatParams.apply(this, arguments)); } public trace(): void { diff --git a/Console/console_helper.android.ts b/Console/console_helper.android.ts index a44bfa61e..37ad2358e 100644 --- a/Console/console_helper.android.ts +++ b/Console/console_helper.android.ts @@ -1,6 +1,6 @@ var TAG = 'JS'; -export var log = function (message: string) { +export var helper_log = function (message: string) { android.util.Log.v(TAG, message); } diff --git a/Console/console_helper.d.ts b/Console/console_helper.d.ts index b72d1ae3c..5c94fa29a 100644 --- a/Console/console_helper.d.ts +++ b/Console/console_helper.d.ts @@ -1,4 +1,4 @@ -export declare var log: (message: string) => void; +export declare var helper_log: (message: string) => void; export declare var info: (message: string) => void; export declare var error: (message: string) => void; export declare var warn: (message: string) => void; diff --git a/Console/console_helper.ios.ts b/Console/console_helper.ios.ts index 016a24ebc..6c3b298dd 100644 --- a/Console/console_helper.ios.ts +++ b/Console/console_helper.ios.ts @@ -1,7 +1,7 @@ // TODO: we should use Foundation.NSLog() but it currently does not work // TODO: Is there a better way to implement the info/warn/error -export var log = function (message: string) { +export var helper_log = function (message: string) { log('log: ' + message); } diff --git a/globals/index.ts b/globals/index.ts index 5e78e0ee6..b908946b8 100644 --- a/globals/index.ts +++ b/globals/index.ts @@ -1,8 +1,10 @@ -declare var module, setTimeout, clearTimeout, setInterval, clearInterval; +declare var setTimeout, clearTimeout, setInterval, clearInterval; import timer = require("timer/timer"); -module.exports = timer; +import consoleModule = require("Console/console"); setTimeout = timer.setTimeout; clearTimeout = timer.clearTimeout; setInterval = timer.setInterval; -clearInterval = timer.clearTimeout; \ No newline at end of file +clearInterval = timer.clearTimeout; + +console = new consoleModule.Console(); \ No newline at end of file