blob: e054f62def440927d8a478cf347570b180dd70ce [file] [log] [blame]
Kevin Lubick275eaff2019-01-04 14:38:29 -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) {
6 delete Module['then'];
7 Module['onAbort'] = reject;
Kevin Lubickfaa73872019-01-06 22:27:54 -05008 if (runtimeInitialized) {
9 resolve(Module);
10 } else {
11 addOnPostRun(function() {
12 resolve(Module);
13 });
14 }
Kevin Lubick275eaff2019-01-04 14:38:29 -050015 });
16}
17// TODO(kjlubick): Shut .then() entirely off in 0.6.0 by uncommenting below.
18// delete Module['then'];