Attaching event handlers in Javascript

I'm working on a jupyter notebook widget to display ECG data. In the basic form it contains a small graph with an overview of the whole recording and a larger one to view a few seconds. The user should be able to scroll the detail plot by clicking and dragging on the overview plot.

This can be done through the callback models from Python, and I managed to attach a "pan" event handler. However, this callback also needs to access the jupyter widget instance to interact with the notebook, and the notebook kernel. I'd like to avoid a round-trip through the python side, for example through using comms channels etc, because changing the limits of the plot really doesn't require any input from the Python kernel.

So it would be best to attach a callback from the jupyter widget constructor. My code acquires the model instance of the Bokeh plot, but I haven't yet figured out how to attach a callback to the UI events.

Can this be done, and if so, how?