diff options
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r-- | src/js/binaryen.js-post.js | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index cef5c989d..3f8b6545b 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -4807,46 +4807,12 @@ Module['exit'] = function(status) { if (status != 0) throw new Error('exiting due to error: ' + status); }; -// Indicates if Binaryen has been loaded and is ready -Module['isReady'] = runtimeInitialized; - -// Provide a mechanism to tell when the module is ready -// -// if (!binaryen.isReady) await binaryen.ready; -// ... -// -let pendingPromises = []; -let initializeError = null; - -Object.defineProperty(Module, 'ready', { - get() { - return new Promise((resolve, reject) => { - if (initializeError) { - reject(initializeError); - } else if (runtimeInitialized) { - resolve(Module); - } else { - pendingPromises.push({ resolve, reject }); - } - }); - } -}); - // Intercept the onRuntimeInitialized hook if necessary if (runtimeInitialized) { initializeConstants(); } else { Module['onRuntimeInitialized'] = (super_ => () => { - try { - initializeConstants(); - if (super_) super_(); - Module['isReady'] = true; - pendingPromises.forEach(p => { p.resolve(Module) }); - } catch (e) { - initializeError = e; - pendingPromises.forEach(p => { p.reject(e) }); - } finally { - pendingPromises = []; - } + initializeConstants(); + if (super_) super_(); })(Module['onRuntimeInitialized']); } |