How to add a js_on_event to a figure tool?

Hello,

I am struggling to add a js_on_event to a figure tool.
In the simple example below, the message “test” does not shows up in the console.
None of the 3 methods work, I don’t know how to access the button from the toolbar:

from bokeh.plotting import figure, show
from bokeh.models.tools import ResetTool

p = figure(width=400, height=400)

# method 1
p.toolbar.js_on_event(
    "button_click", 
    CustomJS(
        code="""
    console.log('test');
    """
    )
)

# method 2
reset_tool = [v for v in p.toolbar.tools if isinstance(v, ResetTool)][0]

reset_tool.js_on_event(
    "button_click", 
    CustomJS(
        code="""
    console.log('test');
    """
    )
)


# method 3
reset_tool = [v for v in p.tools if isinstance(v, ResetTool)][0]

reset_tool.js_on_event(
    "button_click", 
    CustomJS(
        code="""
    console.log('test');
    """
    )
)

# add a scatter circle renderer with a size, color, and alpha
p.scatter([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)



# show the results
show(p)

Anyone has an idea?
Thanks

AFAIK nothing on the toolbar (e.g. the toolbar icons) emits ButtonEvent so I would no expect that any of the above to do anything. The ResetTool specifically emits a Reset event, which seems like it would be what you are looking for. Alternatively you can add a custom toolbar icon using CustomAction —that executes a CustomJS you provide whenever a users clicks it.

Thanks @Bryan, do you know how to capture this Reset event such that I can trigger CustomJS code when the Reset event is emited?