How do I use Property.set()?

The code


Does not work. To be precise it works the unexpected way, it resets the value. How do I use that?

The properties are needed in order to provide interoperability with the Dart core, and initially we did not mean to use them in the way you suggested. However, it could still be done. The tricky part is that property.get is actually a property that defines a getter, and not the getter itself; you have to call it then with two parameters, first one being an object you want to modify (the default JSViewer implementation ignores it and uses “this”), and second the value. So what you meant could be done like that:

this.getProperty("prop").set(null, "ok");

Admittedly, this is not the ideal syntax for JavaScript, and we are looking at way to improve it. Perhaps the following might work better (we can do it by using Proxy):

this.props.prop = "ok"