documenting the test function; need to show it to a few people
This commit is contained in:
parent
2e44e1cfdb
commit
8e3c2cf920
|
@ -14,16 +14,23 @@
|
|||
;; 2. A raw JavaScript function that can fire events
|
||||
|
||||
|
||||
;; Let's attach the send-event function to a toplevel function on the window.
|
||||
(void ((js-function (js-eval "function(x) { window.sendTheTick = x; }"))
|
||||
send-event))
|
||||
;; js-function lifts JavaScript functions to regular function we can call.
|
||||
|
||||
|
||||
(define (handle-event w v e f g)
|
||||
(displayln e)
|
||||
(displayln f)
|
||||
(displayln g)
|
||||
(define (tick w v)
|
||||
(add1 w))
|
||||
|
||||
|
||||
;; Finally, let's use our big bang:
|
||||
(big-bang 0
|
||||
(on-event handle-event)
|
||||
(on-event tick) ;; Note the on-event here
|
||||
(stop-when (lambda (w v) (> w 5))))
|
||||
|
||||
|
||||
;; Run this program. A big-bang should be in progress and show 0.
|
||||
;;
|
||||
;; Next, open up your developer window, and call window.sendTheTick().
|
||||
;; You should see the world respond.
|
||||
|
|
Loading…
Reference in New Issue
Block a user