clj-commons/seesaw

Timer delay does not default to 1000 milliseconds

shoooe opened this issue · 2 comments

In the seesaw.timer documentation it says:

:delay Delay, in milliseconds, between calls. Defaults to 1000.

That's unfortunately not true, as this simple snippet of code can prove:

(defn -main []
  (let [canv (canvas :background :red)
        tim (timer 
          (fn [[c b]] 
            (if b
              (config! c :background :black)
              (config! c :background :red))
            [c (not b)])
          :initial-value [canv true])]
    (show! 
      (frame 
        :title "Sample" 
        :width 500 :height 200
        :content canv
        :on-close :exit))))

This is probably due to the fact that in the timer implementation, you are calling the constructor passing 0 as first argument, which in the Timer class represents both the initial delay and the delay between calls (this is also true for Java 8's Timer).

Can this be closed?

Yep.