ready.js 486 B

12345678910111213141516
  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.
  4. Module['ready'] = function() {
  5. return new Promise(function (resolve, reject) {
  6. Module['onAbort'] = reject;
  7. if (runtimeInitialized) {
  8. resolve(Module);
  9. } else {
  10. addOnPostRun(function() {
  11. resolve(Module);
  12. });
  13. }
  14. });
  15. }
  16. delete Module['then'];