From de7e787283b1f9742993ef4033c8140d9f4d8eb3 Mon Sep 17 00:00:00 2001 From: Peter Kanev Date: Thu, 16 Mar 2017 15:45:21 +0200 Subject: [PATCH] always attach console implementation on android --- tns-core-modules/globals/globals.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tns-core-modules/globals/globals.ts b/tns-core-modules/globals/globals.ts index dedfb4252..1e2e28b0e 100644 --- a/tns-core-modules/globals/globals.ts +++ b/tns-core-modules/globals/globals.ts @@ -121,7 +121,11 @@ if ((global).__snapshot) { registerOnGlobalContext("fetch", "fetch"); } -if (!(global).console) { +// check whether the 'android' namespace is exposed +// if positive - the current device is an Android +// so a custom implementation of the global 'console' object is attached. +// otherwise do nothing on iOS - the NS runtime provides a native 'console' functionality. +if ((global).android) { const consoleModule = require("console"); (global).console = new consoleModule.Console(); }