faa73875d2
I think this would only commonly happen for cases which files aren't being loaded (debug asmjs), but could happen if multiple ready() calls are made (which is discouraged). Bug: skia: Change-Id: If848aad8603f997661502563136ac590cc9a6d5a Reviewed-on: https://skia-review.googlesource.com/c/181409 Reviewed-by: Kevin Lubick <kjlubick@google.com>
18 lines
593 B
JavaScript
18 lines
593 B
JavaScript
// See https://github.com/kripken/emscripten/issues/5820#issuecomment-385722568
|
|
// for context on why the .then() that comes with Module breaks things (e.g. infinite loops)
|
|
// and why the below fixes it.
|
|
Module['ready'] = function() {
|
|
return new Promise(function (resolve, reject) {
|
|
delete Module['then'];
|
|
Module['onAbort'] = reject;
|
|
if (runtimeInitialized) {
|
|
resolve(Module);
|
|
} else {
|
|
addOnPostRun(function() {
|
|
resolve(Module);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
// TODO(kjlubick): Shut .then() entirely off in 0.4.0 by uncommenting below.
|
|
// delete Module['then'];
|