export Module when wasm
This commit is contained in:
Родитель
03ebf6fc59
Коммит
50f7b19f20
2
emcc
2
emcc
|
@ -1820,7 +1820,7 @@ try {
|
|||
if shared.Settings.WASM:
|
||||
logging.debug('converting to WebAssembly')
|
||||
wasm_target = unsuffixed(js_target) + '.wasm'
|
||||
subprocess.check_call([shared.PYTHON, shared.path_from_root('third_party', 'wasm-polyfill', 'wasmator.py'), js_target, wasm_target])
|
||||
subprocess.check_call([shared.PYTHON, shared.path_from_root('third_party', 'wasm-polyfill', 'wasmator.py'), js_target, wasm_target, shared.Settings.EXPORT_NAME])
|
||||
|
||||
log_time('final emitting')
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import shared as emscripten
|
|||
|
||||
jsfile = sys.argv[1]
|
||||
wasmfile = sys.argv[2]
|
||||
export_name = sys.argv[3]
|
||||
|
||||
tempfile = jsfile + '.temp.js'
|
||||
tempfile2 = jsfile + '.temp2.js'
|
||||
|
@ -86,17 +87,20 @@ function runEmscriptenModule(Module, unwasmed_) {
|
|||
|
||||
''' + patched + '''
|
||||
|
||||
return Module;
|
||||
}
|
||||
|
||||
''' + open(path_in_polyfill('jslib', 'load-wasm.js')).read() + '''
|
||||
|
||||
// note: web worker messages must be queued, as we delay the scripts chance to listen to them
|
||||
|
||||
var ''' + export_name + ''';
|
||||
|
||||
loadWebAssembly("''' + wasmfile + '''", 'load-wasm-worker.js').then(function(unwasmed) {
|
||||
if (typeof importScripts === 'function') {
|
||||
onmessage = null;
|
||||
}
|
||||
runEmscriptenModule(typeof Module !== 'undefined' ? Module : {}, unwasmed);
|
||||
''' + export_name + ''' = runEmscriptenModule(typeof Module !== 'undefined' ? Module : {}, unwasmed);
|
||||
if (typeof importScripts === 'function' && onmessage) {
|
||||
queuedMessages.forEach(function(e) {
|
||||
onmessage(e);
|
||||
|
|
Загрузка…
Ссылка в новой задаче