arudradey/ml-cpu-storage / emsdk /upstream /emscripten /src /postamble_modularize.js
arudradey's picture
download
raw
1.19 kB
// In MODULARIZE mode we wrap the generated code in a factory function
// and return either the Module itself, or a promise of the module.
//
// We assign to the `moduleRtn` global here and configure closure to see
// this as an extern so it won't get minified.
if (runtimeInitialized) {
moduleRtn = Module;
} else {
// Set up the promise that indicates the Module is initialized
moduleRtn = new Promise((resolve, reject) => {
readyPromiseResolve = resolve;
readyPromiseReject = reject;
});
}
#if ASSERTIONS
// Assertion for attempting to access module properties on the incoming
// moduleArg. In the past we used this object as the prototype of the module
// and assigned properties to it, but now we return a distinct object. This
// keeps the instance private until it is ready (i.e the promise has been
// resolved).
for (const prop of Object.keys(Module)) {
if (!(prop in moduleArg)) {
Object.defineProperty(moduleArg, prop, {
configurable: true,
get() {
abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)
}
});
}
}
#endif

Xet Storage Details

Size:
1.19 kB
·
Xet hash:
9bd6a665d6b3577bc623bf298e8b732a612d284bad7fa58343b52bd1c4daad62

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.