Make how global object is fetched more general.

This commit is contained in:
Brad Nelson
2022-07-12 13:18:01 -07:00
parent 496b7d8c81
commit cd9228a609

View File

@ -271,12 +271,13 @@ var ffi = {
heap[128 + 6] = 256 * 4; // set g_sys.heap = 256 * 4;
var globalObj;
if (typeof window === 'undefined') {
globalObj = global;
} else {
globalObj = window;
function getGlobalObj() {
return (function(g) {
return g;
})(new Function('return this')());
}
var globalObj = getGlobalObj();
var module = VM(globalObj, ffi, heap);
Init();
setTimeout(function() {