This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds support for the upcoming event callbacks in bokeh, currently being developed here.
Summary of how it works
Check if any of the skip_conditions apply, if so, skip
Grab all the requested attributes from the models and accumulate them in data
Check if there is a Comm instantiated otherwise open it and store it in a global registry
Check if there is a comm_state for the Comm otherwise make one defining a event_buffer, a blocked flag and a time
Check whether the comm_state is blocked or has timed out (i.e. Date.now()>comm_state.time+timeout):
a) if it's blocked put data along with cb_obj.event.event_name on top of the event_buffer
b) if it's not blocked also prepend to event_buffer but also call process_event with small timeout. The small timeout acts as a debouncing mechanism as new events can be pushed ahead of the original event in the event queue. After process_events is called set the comm_state to blocked
process_events will iterate over the event_buffer and filter out older duplicated events. This ensures only the latest event of each type is processed (e.g. to ensure panstart, pan and panend are all processed). (Can probably be simplified)
In python everything does its thing and sends back a message either acknowledging execution or failure. This message also contains the comm_id, with which the comm_state is looked up. If there is something on the event_buffer process it and keep the Comm blocked, otherwise unblock.
Finalize naming for Callback attributes
Add tests to ensure callbacks reference correct handles/models
Add documentation about defining custom Stream/Callbacks
The text was updated successfully, but these errors were encountered:
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.