liyujie
2025-08-28 786ff4f4ca2374bdd9177f2e24b503d43e7a3b93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 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'];