trying to make world event sources out of javascript function call
This commit is contained in:
parent
19a8bc6840
commit
c598b1933b
|
@ -2,8 +2,13 @@
|
|||
(function() {
|
||||
"use strict";
|
||||
|
||||
var resourceStructType =
|
||||
MACHINE.modules['whalesong/web-world.rkt'].getNamespace().get('');
|
||||
var WebWorld =
|
||||
MACHINE.modules['whalesong/web-world.rkt'].privateExports;
|
||||
var EventSource = WebWorld.EventSource;
|
||||
var EventHandler = WebWorld.EventHandler;
|
||||
|
||||
var makeClosure = plt.runtime.makeClosure;
|
||||
var finalizeClosureCall = plt.runtime.finalizeClosureCall;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -36,4 +41,16 @@
|
|||
sender: sender };
|
||||
};
|
||||
|
||||
|
||||
var makeJsWorldEvent = makeClosure(
|
||||
'make-js-world-event',
|
||||
0,
|
||||
function(M) {
|
||||
finalizeClosureCall(M, "first value", "second value");
|
||||
|
||||
});
|
||||
|
||||
|
||||
EXPORTS['make-js-world-event'] = makeJsWorldEvent;
|
||||
|
||||
}());
|
|
@ -8,9 +8,14 @@
|
|||
send-event)
|
||||
|
||||
|
||||
|
||||
on-event
|
||||
send-event
|
||||
|
||||
|
||||
(define (handle-event w v)
|
||||
(add1 w))
|
||||
|
||||
(big-bang 0
|
||||
(on-event handle-event)
|
||||
(stop-when (lambda (w) (> w 5))))
|
||||
;(big-bang 0
|
||||
; (on-event handle-event)
|
||||
; (stop-when (lambda (w) (> w 5))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user