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(); }