still chasing exceptions

This commit is contained in:
Danny Yoo 2011-08-29 08:24:46 -04:00
parent 5d24ac1af7
commit 944ac897cf
2 changed files with 14 additions and 9 deletions

View File

@ -36,5 +36,5 @@
(big-bang 0 (big-bang 0
(initial-view index.html) (initial-view index.html)
(on-tick tick 10) (on-tick tick .5)
(to-draw draw)) (to-draw draw))

View File

@ -261,16 +261,14 @@
// HACK: every node that is bound needs to have an id. We // HACK: every node that is bound needs to have an id. We
// enforce this by mutating the node. // enforce this by mutating the node.
if (this.cursor.node.id === undefined) { if (! this.cursor.node.id) {
this.cursor.node.id = ("__webWorldId_" + mockViewIdGensym++); this.cursor.node.id = ("__webWorldId_" + mockViewIdGensym++);
} }
return this.act( return this.act(
function(cursor) { function(cursor) {
var newCursor = cursor.replaceNode($(cursor.node).clone(true).get(0)); var newCursor = cursor.replaceNode($(cursor.node).clone(true).get(0));
var handler = new EventHandler(name, var handler = new EventHandler(name,
new DomEventSource(name, new DomEventSource(name, newCursor.node),
newCursor.node),
worldF); worldF);
if (currentBigBangRecord !== undefined) { if (currentBigBangRecord !== undefined) {
currentBigBangRecord.startEventHandler(handler); currentBigBangRecord.startEventHandler(handler);
@ -281,15 +279,20 @@
var handler = new EventHandler(name, var handler = new EventHandler(name,
new DomEventSource( new DomEventSource(
name, name,
$(that.cursor.node).attr('id')), that.cursor.node.id),
worldF); worldF);
return eventHandlers.concat([handler]); return eventHandlers.concat([handler]);
}, },
function(view) { function(view) {
// HACK: every node that is bound needs to have an id. We
// enforce this by mutating the node.
if (! view.focus.get(0).id) {
view.focus.get(0).id = ("__webWorldId_" + mockViewIdGensym++);
}
var handler = new EventHandler(name, var handler = new EventHandler(name,
new DomEventSource( new DomEventSource(
name, name,
view.focus.get(0)), view.focus.get(0).id),
worldF); worldF);
view.addEventHandler(handler); view.addEventHandler(handler);
currentBigBangRecord.startEventHandler(handler); currentBigBangRecord.startEventHandler(handler);
@ -829,6 +832,8 @@
mockView = mockView.updateFocus('#' + nextEvent.who.id); mockView = mockView.updateFocus('#' + nextEvent.who.id);
} }
console.log('dispatching event', nextEvent);
// FIXME: deal with event data here // FIXME: deal with event data here
racketWorldCallback = nextEvent.handler.racketWorldCallback; racketWorldCallback = nextEvent.handler.racketWorldCallback;
racketWorldCallback(MACHINE, racketWorldCallback(MACHINE,
@ -1181,7 +1186,7 @@
3, 3,
function(MACHINE) { function(MACHINE) {
var view = checkMockView(MACHINE, 'view-bind', 0); var view = checkMockView(MACHINE, 'view-bind', 0);
var name = checkSymbolOrString(MACHINE, 'view-bind', 1).toString(); var name = checkSymbolOrString(MACHINE, 'view-bind', 1);
var worldF = wrapFunction(checkProcedure(MACHINE, 'view-bind', 2)); var worldF = wrapFunction(checkProcedure(MACHINE, 'view-bind', 2));
return view.bind(name, worldF); return view.bind(name, worldF);
}); });