Merge pull request #3815 from NativeScript/pete/fix-android-console

Always attach console implementation on android
This commit is contained in:
Peter Kanev
2017-03-21 08:27:26 +02:00
committed by GitHub

View File

@@ -121,7 +121,11 @@ if ((<any>global).__snapshot) {
registerOnGlobalContext("fetch", "fetch"); registerOnGlobalContext("fetch", "fetch");
} }
if (!(<any>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 ((<any>global).android) {
const consoleModule = require("console"); const consoleModule = require("console");
(<any>global).console = new consoleModule.Console(); (<any>global).console = new consoleModule.Console();
} }