skia2/modules/canvaskit/ready.js
Kevin Lubick 3f67f411d8 [canvaskit] Move from experimental to modules
Bug: skia:
Change-Id: I2ffd54cf81c974f3a80103e1726a06067cc90d82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200044
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-03-11 21:09:52 +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'];