bokeh / jupyter_bokeh

An extension for rendering Bokeh content in JupyterLab notebooks
BSD 3-Clause "New" or "Revised" License
253 stars 48 forks source link

Add option to combine events and support other events #102

Closed philippjfr closed 4 years ago

philippjfr commented 4 years ago

This queues events if the combine_events option is enabled and combines events on the same property if the previous event has not finished processing.

The basic approach here is:

  1. Attach listener to register kernel status idle events
  2. If there are no events queued send event and set _idle = false
  3. If another event is triggered while !idle then queue event but drop any previous events on the same model attribute
  4. When event finishes kernel status idle event is triggered process the next item in the queue
  5. Repeat until there are no more events in the queue, then set _idle = true
philippjfr commented 4 years ago

@mattpap Really not entirely happy with the implementation, but this scheme of ignoring/combining duplicate events has served us extremely well in HoloViews/Panel.

philippjfr commented 4 years ago

@mattpap I've implemented the other event types on this PR now because it was simpler. If you need me to I can split out the handling for MessageSent, ColumnsPatched and ColumnsStreamed events into another PR, otherwise this is ready to merge (after your review of course).