How to subscribe to client side events?

I’d like to do something similar to server side hooks, but client side.

Specifically, when a comment is added, I need to run a custom script.

Is there already a mechanism to subscribe to such events?


There is no generic way of doing things, you might have to see the code and listen to standard DOM events.

Warning - comments UI is breaking in v5

In theory, would you be happy to consider a pull request on something like this? (Generic broadcast + subscribe capability)

Contributions are welcome! You get to share the copyright too.

Btw, in v4 you could listen to standard doctype events

frappe.ui.form.on("[DocType]", "[event]", function(frm) {  /**/ });

Standard events are refresh, onload, onchange on fieldnames.

I am not sure if this is what you are looking for.