Skip to content

Commit 826d2c7

Browse files
committed
Don't clobbber window.console
1 parent bd8c32d commit 826d2c7

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/_patch/browserstack.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,12 @@
3737
req.send(data);
3838
}
3939

40-
if (typeof console !== 'object') {
41-
var console = {};
42-
window.console = console;
43-
}
44-
45-
_console_log = console.log;
46-
47-
console.log = function () {
40+
var browserstack_console = console || window.console || {};
41+
browserstack_console.log = function () {
4842
var args = BrowserStack.util.toArray(arguments).map(BrowserStack.util.inspect);
4943
post('/_log/', { arguments: args }, function () {});
5044
};
51-
console.warn = function () {
45+
browserstack_console.warn = function () {
5246
var args = BrowserStack.util.toArray(arguments).map(BrowserStack.util.inspect);
5347
post('/_log/', { arguments: args }, function () {});
5448
};
@@ -60,4 +54,6 @@
6054
BrowserStack.worker_uuid = getParameterByName('_worker_key');
6155

6256
window.BrowserStack = BrowserStack;
57+
window.console = browserstack_console;
58+
console = browserstack_console;
6359
})();

0 commit comments

Comments
 (0)