I have the following in a js file:
function serialize() {
return new Uint8Array(1024);
}
I invoke that function with the java scripting api like so:
byte[] bytes = (byte[]) ((Invocable)engine).invokeFunction(SERIALIZE_FUNC);
Which immediately throws the exception:
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "Uint8Array" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "Uint8Array" is not defined. (<Unknown source>#1)
I dont know much about javascript, but I thought this is how you define an array in JavaScript?
return [];
. – tieTYT 19 hours ago