#lang planet dyoo/whalesong
(require (planet dyoo/whalesong/js/world)
(planet dyoo/whalesong/js)
(planet dyoo/whalesong/web-world))
(define setup-timer
(js-function->procedure (js-eval "function(x) { window.sendTheTick = x; }")))
(define shutdown-timer
(js-function->procedure (js-eval "function(_) { window.sendTheTick = void(0); }")))
(define on-event (make-world-event-handler setup-timer shutdown-timer))
(define (tick w v)
(add1 w))
(big-bang 0
(on-event tick) (stop-when (lambda (w v) (> w 5))))