We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6c289b3 commit 871825cCopy full SHA for 871825c
index.js
@@ -1,6 +1,6 @@
1
global.mpjscache = {};
2
let pyjs;
3
-let browser = true;
+const browser = (typeof window || typeof importScripts) !== 'undefined';
4
let stdout_text = '';
5
let stdout_ready = false;
6
let stdout_print = (stdout) => {
@@ -22,7 +22,6 @@ if (typeof webpackJsonp !== 'object') {
22
pyjs = require('fs').readFileSync(__dirname + '/js.py').toString();
23
}
24
else {
25
- window.global = window;
26
pyjs = require('!raw-loader!./js.py').default;
27
28
@@ -37,6 +36,7 @@ function wait_exist(fn) {
37
36
38
39
if (browser) {
+ window.global = window;
40
const stdout = document.createElement('div');
41
stdout.id = 'mp_js_stdout';
42
stdout.style.display = 'none';
0 commit comments