trying to get it to work
This commit is contained in:
parent
c598b1933b
commit
ecb62a63e8
3
js/world.rkt
Normal file
3
js/world.rkt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#lang s-exp "../lang/base.rkt"
|
||||||
|
(require "world/main.rkt")
|
||||||
|
(provide (all-from-out "world/main.rkt"))
|
|
@ -3,13 +3,17 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var WebWorld =
|
var WebWorld =
|
||||||
MACHINE.modules['whalesong/web-world.rkt'].privateExports;
|
MACHINE.modules['whalesong/web-world/impl.rkt'].privateExports;
|
||||||
var EventSource = WebWorld.EventSource;
|
var EventSource = WebWorld.EventSource;
|
||||||
var EventHandler = WebWorld.EventHandler;
|
var EventHandler = WebWorld.EventHandler;
|
||||||
|
|
||||||
var makeClosure = plt.runtime.makeClosure;
|
var makeClosure = plt.baselib.functions.makeClosure;
|
||||||
|
var makePrimitive = plt.baselib.functions.makePrimitive;
|
||||||
var finalizeClosureCall = plt.runtime.finalizeClosureCall;
|
var finalizeClosureCall = plt.runtime.finalizeClosureCall;
|
||||||
|
|
||||||
|
var checkProcedure = plt.baselib.check.checkProcedure;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an event source coupled to a JavaScript function. Calling the function
|
* Creates an event source coupled to a JavaScript function. Calling the function
|
||||||
|
@ -46,8 +50,19 @@
|
||||||
'make-js-world-event',
|
'make-js-world-event',
|
||||||
0,
|
0,
|
||||||
function(M) {
|
function(M) {
|
||||||
finalizeClosureCall(M, "first value", "second value");
|
var eventSourceRecord = makeJsEventSource();
|
||||||
|
eventSourceRecord.eventSource
|
||||||
|
var makeHandler = makePrimitive('make-js-world-event',
|
||||||
|
1,
|
||||||
|
function(M) {
|
||||||
|
var onEvent = checkProcedure(M, 'js-world-event-handler', 0);
|
||||||
|
return new EventHandler('js-world-event',
|
||||||
|
eventSourceRecord.eventSource,
|
||||||
|
onEvent);
|
||||||
|
});
|
||||||
|
finalizeClosureCall(M,
|
||||||
|
"first value",
|
||||||
|
eventSourceRecord.sender);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#lang s-exp "../lang/js/js.rkt"
|
#lang s-exp "../../lang/js/js.rkt"
|
||||||
(require "../../web-world.rkt")
|
(require "../../web-world.rkt")
|
||||||
(declare-implementation
|
(declare-implementation
|
||||||
#:racket "racket-impl.rkt"
|
#:racket "racket-impl.rkt"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#lang planet dyoo/whalesong
|
#lang planet dyoo/whalesong
|
||||||
(require (planet dyoo/whalesong/js/world))
|
(require (planet dyoo/whalesong/js/world)
|
||||||
|
(planet dyoo/whalesong/js))
|
||||||
|
|
||||||
(define-values (on-event send-event)
|
(define-values (on-event send-event)
|
||||||
(make-js-world-event))
|
(make-js-world-event))
|
||||||
|
@ -8,7 +9,6 @@
|
||||||
send-event)
|
send-event)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
on-event
|
on-event
|
||||||
send-event
|
send-event
|
||||||
|
|
||||||
|
|
|
@ -2202,7 +2202,7 @@
|
||||||
|
|
||||||
|
|
||||||
// For private importers of the web-world library, like the FFI's js/world library.
|
// For private importers of the web-world library, like the FFI's js/world library.
|
||||||
Exports['EventSource'] = EventSource;
|
EXPORTS['EventSource'] = EventSource;
|
||||||
Exports['EventHandler'] = EventHandler;
|
EXPORTS['EventHandler'] = EventHandler;
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
}());
|
}());
|
Loading…
Reference in New Issue
Block a user