Can I run a javascript callback at a specific point in a function?

I have a button that performs some calculations and outputs a figure. What I want to do is run a javascript callback at the END of the calculation, rather than the beginning (which is when it would run if I passed it to the Button() model as a callback). Is there any way to make this happen?

A possible solution would be to attach your second callback to a model that changes when you run your first callback. If you are using bokeh server and have the flexibility you use a server callback, you could also try adding a next tick callback to your current document during your first callback curdoc().add_next_tick_callback(second_callback_function).

···

On Wed, Mar 1, 2017 at 11:22 AM, Jeremy Bowyer [email protected] wrote:

I have a button that performs some calculations and outputs a figure. What I want to do is run a javascript callback at the END of the calculation, rather than the beginning (which is when it would run if I passed it to the Button() model as a callback). Is there any way to make this happen?

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/235e86ea-b659-4f90-a75d-1a15e34b32e1%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Additionally, this PR for a more general "events" mechanism (when it is merged) will probably help to make it easier to implement things like this:

  https://github.com/bokeh/bokeh/pull/5941

It is expected to land in 0.12.5 in a few weeks. Thanks,

Bryan

···

On Mar 2, 2017, at 16:07, Tyler Nickerson <[email protected]> wrote:

A possible solution would be to attach your second callback to a model that changes when you run your first callback. If you are using bokeh server and have the flexibility you use a server callback, you could also try adding a next tick callback to your current document during your first callback curdoc().add_next_tick_callback(second_callback_function).

On Wed, Mar 1, 2017 at 11:22 AM, Jeremy Bowyer <[email protected]> wrote:
I have a button that performs some calculations and outputs a figure. What I want to do is run a javascript callback at the END of the calculation, rather than the beginning (which is when it would run if I passed it to the Button() model as a callback). Is there any way to make this happen?

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/235e86ea-b659-4f90-a75d-1a15e34b32e1%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFS1qqzFUDsGS-HpN92ynmtR9jgf8p2rovy2_uYof05inw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Sounds great, I’ll keep an eye out for it. As of now I’m simulating the same thing by creating an invisible button with the js callback I want at the end of the function, and using javascript to simulate a click. It works, but having built-in functionality will be nice and far less hack-y.

···

On Saturday, March 11, 2017 at 1:19:24 PM UTC-5, Bryan Van de ven wrote:

Additionally, this PR for a more general “events” mechanism (when it is merged) will probably help to make it easier to implement things like this:

    [https://github.com/bokeh/bokeh/pull/5941](https://github.com/bokeh/bokeh/pull/5941)

It is expected to land in 0.12.5 in a few weeks. Thanks,

Bryan

On Mar 2, 2017, at 16:07, Tyler Nickerson [email protected] wrote:

A possible solution would be to attach your second callback to a model that changes when you run your first callback. If you are using bokeh server and have the flexibility you use a server callback, you could also try adding a next tick callback to your current document during your first callback curdoc().add_next_tick_callback(second_callback_function).

On Wed, Mar 1, 2017 at 11:22 AM, Jeremy Bowyer [email protected] wrote:

I have a button that performs some calculations and outputs a figure. What I want to do is run a javascript callback at the END of the calculation, rather than the beginning (which is when it would run if I passed it to the Button() model as a callback). Is there any way to make this happen?


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/235e86ea-b659-4f90-a75d-1a15e34b32e1%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAAd1xFS1qqzFUDsGS-HpN92ynmtR9jgf8p2rovy2_uYof05inw%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.