Manually create a bokeh Tap() event object in JS and emit it

Hi all,

In my code I have a situation where I want to manually create a bokeh Tap event for a figure (glyph). How can I create an instance of this object manually and then emit it?

Use-case is that I have a callback watching for tap events on a figure, and by doing something else on the web page, I want to trigger the Tap, which then triggers my js_on_event tap callback.

I want to do something like this in JS:

var selected_timestamp = 148572942957921;

var customEvent = Bokeh.Events.Tap({model_id:fig_id, sx: 1, sy: 1, x:selected_timestamp,y:1})

window.dispatchEvent(customEvent)

I looked in BokehJS code and see where the Tap() is defined (extending BokehEvents) but don’t know how to manually create and emit it (Bokeh.Events.Tap is just an example above, its not correct).

Thanks for any help! Been stuck for a while with this one…
Corey

i would also like to know how to manually emit events! in my case, i’ve got:

play = Button()
play_callback = CustomJS(args=..., code=...)
play.js_on_event(ButtonClick, play_callback) 

somewhere else in the python code i’d like that CustomJS code to be manually evaluated. play_callback() doesn’t work. is there a way to emit a ButtonClick event to play? thanks!