// Sometimes an existing Module object exists with properties
// meant to overwrite the default module functionality. Here
// we collect those properties and reapply _after_ we configure
// the current environment's defaults to avoid having to be so
// defensive during initialization.
varmoduleOverrides={};
for(varkeyinModule){
if(Module.hasOwnProperty(key)){
moduleOverrides[key]=Module[key];
}
}
// The environment setup code below is customized to use Module.
// *** Environment setup code ***
varENVIRONMENT_IS_WEB=typeofwindow==='object';
// Three configurations we can be running in:
// 1) We could be the application main() thread running in the main JS UI thread. (ENVIRONMENT_IS_WORKER == false and ENVIRONMENT_IS_PTHREAD == false)
// 2) We could be the application main() thread proxied to worker. (with Emscripten -s PROXY_TO_WORKER=1) (ENVIRONMENT_IS_WORKER == true, ENVIRONMENT_IS_PTHREAD == false)
// 3) We could be an application pthread running in a worker. (ENVIRONMENT_IS_WORKER == true and ENVIRONMENT_IS_PTHREAD == true)
if(!ENVIRONMENT_IS_PTHREAD)ENVIRONMENT_IS_PTHREAD=false;// ENVIRONMENT_IS_PTHREAD=true will have been preset in pthread-main.js. Make it false in the main runtime thread.
varPthreadWorkerInit;// Collects together variables that are needed at initialization time for the web workers that host pthreads.
if(typeofprintErr!='undefined')Module['printErr']=printErr;// not present in v8 or older sm
if(typeofread!='undefined'){
Module['read']=read;
}else{
Module['read']=functionread(){throw'no read() available (jsc?)'};
}
Module['readBinary']=functionreadBinary(f){
if(typeofreadbuffer==='function'){
returnnewUint8Array(readbuffer(f));
}
vardata=read(f,'binary');
assert(typeofdata==='object');
returndata;
};
if(typeofscriptArgs!='undefined'){
Module['arguments']=scriptArgs;
}elseif(typeofarguments!='undefined'){
Module['arguments']=arguments;
}
#if USE_CLOSURE_COMPILER
eval("if (typeof gc === 'function' && gc.toString().indexOf('[native code]') > 0) var gc = undefined");// wipe out the SpiderMonkey shell 'gc' function, which can confuse closure (uses it as a minified name, and it is then initted to a non-falsey value unexpectedly)