I’m using an external JS library (https://codemirror.net) in a custom HTML setting. It all works fine (link at the end of the post).
However, if I want more than one instance in my app, I have to maintain a global array of codemirror instances and reference them using a name.
What would be neater is if I could return the newly created instance to Anvil, and Anvil could then send it as a parameter to its
call_js functions when manipulating the codemirror instance.
Problem is, Anvil won’t accept a JS object being assigned to an Anvil one. Which I get.
Is there a way around this?
I tried to serialise it (I even spelled it with a ‘z’) but the serialisation process complained of cyclic references. Stack Overflow had several suggestions for creating my own serialisation function that would get around that. It’s an option, but I’d appreciate the opinions of people far better at JS than me first
Here’s the promised link -