LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 127 forks source link

Need a JSObject property to be bound to jsexported methods #206

Open sammy44nts opened 3 years ago

sammy44nts commented 3 years ago

Hello!

Using Kotlin, I'm having trouble with the 'proper' way to define the JSObject property because Property constructor is private so I can't declare them that way.

I used

        JSObjectPropertiesMap(instance, Any::class.java).apply {
            put("id", instance.getId())
        }

to define a property in the JSObject.

I need the property to use getId() as getter and setId(value) as setter. Do you see a way to redefine JS object property id to bind it to the jsexported getter & setter at the instance creation time in the constructor?

sammy44nts commented 3 years ago

Found a solution for two way communication: