Skip to content
Discussion options

You must be logged in to vote

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:

```{ojs}
//| echo: false
//| display: false
// let reactiveVar be an OJS reactive
{
    window.yourCallback(reactiveVar); // `yourCallback` is a field of the global object.
    return null;
}
```

I haven't tested this, but it should work. If you use reactiveVar in an OJS block, you get a reacti…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@anthonynorth
Comment options

@cscheid
Comment options

@anthonynorth
Comment options

Answer selected by anthonynorth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants