Jinntec / Fore

Fore - declarative user interfaces in plain HTML
MIT License
80 stars 11 forks source link

Geting and setting instance contents programmatically #265

Closed michmech closed 1 month ago

michmech commented 1 month ago

Is it possible to get and set the contents of an instance programmatically, from a client-side script running in the browser?

For getting, I have figured out that I can get (the current state of) an instance by calling getInstanceData() on the <fx-instance> like this, which returns an XMLDocument:

document.querySelector("fx-instance").getInstanceData()

Is it OK to do this? Or is this an undocumented feature which may not be supported in the future?

For setting, I haven't found a way to do that. There is a setInstanceData() on <fx-instance> but that doesn't seem to have any effect.

This doesn't seem to be doable with submissions because a submission sends the instance contents to the server (I want it to stay in the browser). Or am I wrong?