Skip to content

Commit c8803f8

Browse files
authored
Merge pull request NativeScript#3815 from NativeScript/pete/fix-android-console
Always attach console implementation on android
2 parents d258b33 + de7e787 commit c8803f8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tns-core-modules/globals/globals.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ if ((<any>global).__snapshot) {
121121
registerOnGlobalContext("fetch", "fetch");
122122
}
123123

124-
if (!(<any>global).console) {
124+
// check whether the 'android' namespace is exposed
125+
// if positive - the current device is an Android
126+
// so a custom implementation of the global 'console' object is attached.
127+
// otherwise do nothing on iOS - the NS runtime provides a native 'console' functionality.
128+
if ((<any>global).android) {
125129
const consoleModule = require("console");
126130
(<any>global).console = new consoleModule.Console();
127131
}

0 commit comments

Comments
 (0)