Simple Rocket.jl example: Error in Timer

Hello people

I am currently working with the package Rocket.jl and would like to run the sample code at GitHub - biaslab/Rocket.jl: Functional reactive programming extensions library for Julia

but the following code always brings an error message.

using Rocket, Compose, IJulia ; set_default_graphic_size(35cm, 2cm)

function draw_ball(t)
    IJulia.clear_output(true)
    x = -exp(-0.01t) + 1                     # x coordinate
    y = -abs(exp(-0.04t)*(cos(0.1t))) + 0.83 # y coordinate
    display(compose(context(), circle(x, y, 0.01)))
end

source = interval(20) |> take(200) # Take only first 200 emissions

subscription = subscribe!(source, draw_ball)

Message under WIN11 - Julia 1.8.5:

 TimerSubscription()
Error in Timer:

What am I doing wrong here?

Hey @Ralf_Dietrich ,

In what environment are you trying to run this code? It is supposed to work only in Jupyter notebook.

1 Like

Your hint put me on the right track. Thank you very much.

  1. I have now run the code under VSCode as ipynb file.
  2. The code does not work here either because of a bug that is already reported (Undefined reference when using `clear_output` · Issue #1066 · JuliaLang/IJulia.jl · GitHub)
  3. I deleted the line that causes the bug, then you can run the program as a flipbook and you get at least an impression what it should do originally. ==> Just delete the line IJulia.clear_output(true)