All the pieces are there to execute arbitrary JS commands from the server. You can put them on a data property and call them from the client with execJs. But you can’t just do this arbitrarily. You need to make a new hook, dispatch the custom calls to it, and have that hook call execJs.
Wouldn’t it be a lot simpler if LiveView JS just shipped with a hook that could execute any JS commands serialized onto an attribute from the server (ie handle_events)?
I’m aware you can build this yourself without too much trouble but why not just ship this? It would allow anyone to call the full range of JS command stuff from handle_events right out of the box.
Please keep in mind these solutions most likely bypass any future CSP you put in place, making it more vulnerable to XSS attacks. I’d not recommend it as a general solutions and, if someone wants to go down this road, please be aware of the security implications.