1// 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; 8 if (runtimeInitialized) { 9 resolve(Module); 10 } else { 11 addOnPostRun(function() { 12 resolve(Module); 13 }); 14 } 15 }); 16} 17// TODO(kjlubick): Shut .then() entirely off in 0.6.0 by uncommenting below. 18// delete Module['then'];