global is undefined in V8Runtime with node.js node
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
? global.TYPED_ARRAY_SUPPORT
: typedArraySupport()
my script has this snippet. when i'm executing the script in node.js it's not throwing any error. But with Javet it's throwing an error which is stating that global is undefined
It's globalThis by default. If you want to change it to global, please check this doc out.
the doc details about V8RuntimeOptions not NodeRuntimeOptions in the code as well i don't see a option of setting globalName in NodeRuntimeOptions
i tried :
poolConfig.setJSRuntimeType(JSRuntimeType.V8); poolConfig.setGlobalName("global"); javetEnginePool = new JavetEnginePool<>(poolConfig);
still observing that global is undefined
The simplest way is to assign globalThis to global. E.g. const global = globalThis.
yeah ... but i was expecting setGlobalName to work let's say i don't have control over the script. in that case i would expect global to be defined