skia2/experimental/wasm-skp-debugger/ready.js
Nathaniel Nifong ad5f6cdb7e Initial wasm debugger
Bug: skia:
Change-Id: I4d38e60f03bb315dee9c9db655ce168e9b3b475f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/195580
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-05 16:10:15 +00:00

16 lines
486 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) {
Module['onAbort'] = reject;
if (runtimeInitialized) {
resolve(Module);
} else {
addOnPostRun(function() {
resolve(Module);
});
}
});
}
delete Module['then'];