Javet icon indicating copy to clipboard operation
Javet copied to clipboard

Feature Request: generic Bracket propery accessor

Open ckosmowski opened this issue 10 months ago • 1 comments

First of all: Thanks for the awesome work. Since seemingly every Script Integration standard has been abandoned, Javet is a great fit for my project.

I'd like to request a feature:

I am using proxies to bind functions and pass them into javascript. It would be great if there was a feature where i can use the bracket syntax of JavaScript i a generic way (maybe there is already a way but i don't know how):

@V8BracketFunction
fun getProperty(propertyName: String) : String {}
@V8BracketFunction
fun setProperty(propertyName: String, value: String) {}

An in javascript i could do the following on the object:

myObj["myProperty"] = "Test"
console.log(myObj["myProperty"])

So i am basically searching for a way to generically handle property access.

ckosmowski avatar Feb 26 '25 08:02 ckosmowski

I wonder if you have tried @V8Getter and @V8Setter.

caoccao avatar Feb 26 '25 11:02 caoccao