blob: 60f24862d9e63af14b717526c85c1d055e01f14e [file] [log] [blame]
Kevin Lubick65846c02019-01-04 14:16:19 -05001// See https://github.com/kripken/emscripten/issues/5820#issuecomment-385722568
2// for context on why the .then() that comes with Module breaks things (e.g. infinite loops)
3// and why the below fixes it.
4Module['ready'] = function() {
5 return new Promise(function (resolve, reject) {
Kevin Lubick65846c02019-01-04 14:16:19 -05006 Module['onAbort'] = reject;
Kevin Lubickfaa73872019-01-06 22:27:54 -05007 if (runtimeInitialized) {
8 resolve(Module);
9 } else {
10 addOnPostRun(function() {
11 resolve(Module);
12 });
13 }
Kevin Lubick65846c02019-01-04 14:16:19 -050014 });
15}
Kevin Lubick27220832019-02-25 16:04:02 -050016delete Module['then'];