Skip to content

Commit 871825c

Browse files
authored
Update index.js
1 parent 6c289b3 commit 871825c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
global.mpjscache = {};
22
let pyjs;
3-
let browser = true;
3+
const browser = (typeof window || typeof importScripts) !== 'undefined';
44
let stdout_text = '';
55
let stdout_ready = false;
66
let stdout_print = (stdout) => {
@@ -22,7 +22,6 @@ if (typeof webpackJsonp !== 'object') {
2222
pyjs = require('fs').readFileSync(__dirname + '/js.py').toString();
2323
}
2424
else {
25-
window.global = window;
2625
pyjs = require('!raw-loader!./js.py').default;
2726
}
2827

@@ -37,6 +36,7 @@ function wait_exist(fn) {
3736
}
3837

3938
if (browser) {
39+
window.global = window;
4040
const stdout = document.createElement('div');
4141
stdout.id = 'mp_js_stdout';
4242
stdout.style.display = 'none';

0 commit comments

Comments
 (0)