mirror of https://github.com/pyodide/pyodide.git
Don't dump everything in the global namespace
This commit is contained in:
parent
8aca5e2ab3
commit
e0fd7652b6
1
Makefile
1
Makefile
|
@ -13,6 +13,7 @@ CXX=em++
|
|||
OPTFLAGS=-O3
|
||||
CXXFLAGS=-std=c++14 $(OPTFLAGS) -g -I$(CPYTHONINC) -Wno-warn-absolute-paths
|
||||
LDFLAGS=\
|
||||
-s MODULARIZE=1 \
|
||||
$(CPYTHONROOT)/installs/python-$(PYVERSION)/lib/libpython$(PYMINOR).a \
|
||||
-s "BINARYEN_METHOD='native-wasm'" \
|
||||
-s TOTAL_MEMORY=268435456 \
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
var pyodide = {}
|
||||
|
||||
{
|
||||
let baseURL = "{{DEPLOY}}";
|
||||
|
@ -7,14 +6,17 @@ var pyodide = {}
|
|||
wasmXHR.open('GET', wasmURL, true);
|
||||
wasmXHR.responseType = 'arraybuffer';
|
||||
wasmXHR.onload = function() {
|
||||
let Module = {};
|
||||
|
||||
if (wasmXHR.status === 200 || wasmXHR.status === 0) {
|
||||
pyodide.wasmBinary = wasmXHR.response;
|
||||
Module.wasmBinary = wasmXHR.response;
|
||||
} else {
|
||||
alert("Couldn't download the pyodide.asm.wasm binary. Response was " + wasmXHR.status);
|
||||
}
|
||||
|
||||
pyodide.baseURL = baseURL;
|
||||
Module.baseURL = baseURL;
|
||||
var script = document.createElement('script');
|
||||
script.onload = function() { window.pyodide = pyodide(Module); };
|
||||
script.src = baseURL + "pyodide.asm.js";
|
||||
document.body.appendChild(script);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue