Running kotlin.js in Rhino

123 views
Skip to first unread message

Gustav Jonsson

unread,
Nov 18, 2017, 7:37:52 AM11/18/17
to mozilla-rhino
Hi,

In the product I'm working with we are using Rhino to execute JavaScript to allow for our application to be highly configurable. However since I'm not a fan of JavaScript I'd prefer to write that configuration in Kotlin and compile/transpile  it to JavaScript.

The problem I'm having is that when loading the kotlin.js library file in the latest Rhino version I could get my hands on 1.7.7.2  I get an exception that looks like this 

org.mozilla.javascript.EcmaError: ReferenceError: "ArrayBuffer" is not defined. (kotlin.js#910) 

row 910 looks like this

  if (typeof ArrayBuffer.isView === 'undefined') {

When I had a looked at the source it seems like there is no isView() method in the NativeArrayBuffer which I'm assuming is the corresponding java class in Rhino.


I was unable to actually build Rhino to verify that adding the method would solve the problem. 

I'm just wondering if there's someone else out there that's been trying to achieve the same thing, or if anyone with some more experience with Rhino could give me some pointers if I'm on the wrong track?

Cheers
Gustav
Reply all
Reply to author
Forward
0 new messages