Public ojs javascript api #3142
-
Hi, Is there a public javascript api for ojs inputs and variables? I would like to subscribe to changes to ojs inputs in other on-page javascript. I can do this via the Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
We don't explicitly support conversion between OJS and plain Javascript, because the two execution models don't perfectly match. My first suggestion would be to convert the on-page javascript itself to OJS. If that's not possible, though, you should be able to do that conversion yourself in OJS. It'll require a bit of knowledge of Observable's internal execution model, but consider something like:
I haven't tested this, but it should work. If you use |
Beta Was this translation helpful? Give feedback.
We don't explicitly support conversion between OJS and plain Javascript, because the two execution models don't perfectly match.
My first suggestion would be to convert the on-page javascript itself to OJS. If that's not possible, though, you should be able to do that conversion yourself in OJS. It'll require a bit of knowledge of Observable's internal execution model, but consider something like:
I haven't tested this, but it should work. If you use
reactiveVar
in an OJS block, you get a reacti…