Javascript version for custom decoder

What version of Javascript does the custom plugin framework support?

I am seeing an error and I am wondering if the function I am using is supported.

Here is the error:

js vm error: ReferenceError: ‘Uint8Array’ is not defined

The offending line in the code is:

    var byteArray = new DataView( new Uint8Array(bytes).buffer );

I create the byteArray so that I can use the javascript built-in functions to parse the data.

I too am wondering what version of javascript the codec uses. Does it support ecmascript 6? It appears that you cannot use other functions, classes, or the ‘let’ keyword.

Loraserver uses this as the javascript VM, and as stated in the repo, it targets ES5:

  • Otto targets ES5. ES6 features (eg: Typed Arrays) are not supported.

Actually, this might be good to add to https://www.loraserver.io/lora-app-server/use/applications/ :slight_smile: Please let me know if you want to create a pull-request, else I’ll look into this later this week.

I just made a PR adding the comment. :wink:

1 Like

is there any chance to upgrade the JS vm to ES6?

Not until otto (the Go JS VM) supports it: https://github.com/robertkrimen/otto#caveat-emptor.