// In MODULARIZE mode we wrap the generated code in a factory function1// and return either the Module itself, or a promise of the module.2//3// We assign to the `moduleRtn` global here and configure closure to see4// this as and extern so it won't get minified.56if (runtimeInitialized) {7moduleRtn = Module;8} else {9// Set up the promise that indicates the Module is initialized10moduleRtn = new Promise((resolve, reject) => {11readyPromiseResolve = resolve;12readyPromiseReject = reject;13});14}1516#if ASSERTIONS17// Assertion for attempting to access module properties on the incoming18// moduleArg. In the past we used this object as the prototype of the module19// and assigned properties to it, but now we return a distinct object. This20// keeps the instance private until it is ready (i.e the promise has been21// resolved).22for (const prop of Object.keys(Module)) {23if (!(prop in moduleArg)) {24Object.defineProperty(moduleArg, prop, {25configurable: true,26get() {27abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)28}29});30}31}32#endif333435