Add "on event ID BLOCK" support
This commit is contained in:
parent
0561a02e78
commit
e55e19d5e4
|
@ -155,6 +155,9 @@ var modifiedSourceActions = {
|
|||
eventPattern.bindings,
|
||||
block.asES5);
|
||||
},
|
||||
FacetSituation_onEvent: function (_on, _event, id, block) {
|
||||
return '\n.addOnEventHandler((function(' + id.asES5 + ') ' + block.asES5 + '))';
|
||||
},
|
||||
FacetSituation_during: function(_during, pattern, facetBlock) {
|
||||
return buildOnEvent(false,
|
||||
'asserted',
|
||||
|
|
|
@ -45,6 +45,7 @@ Syndicate <: ES5 {
|
|||
FacetSituation
|
||||
= assert FacetPattern AssertWhenClause? #(sc) -- assert
|
||||
| on FacetEventPattern FunctionBodyBlock -- event
|
||||
| on event identifier FunctionBodyBlock -- onEvent
|
||||
| during FacetPattern FacetBlock -- during
|
||||
|
||||
AssertWhenClause = when "(" Expression<withIn> ")"
|
||||
|
@ -77,6 +78,7 @@ Syndicate <: ES5 {
|
|||
assertion = "assertion" ~identifierPart
|
||||
dataspace = "dataspace" ~identifierPart
|
||||
during = "during" ~identifierPart
|
||||
event = "event" ~identifierPart
|
||||
ground = "ground" ~identifierPart
|
||||
message = "message" ~identifierPart
|
||||
metalevel = "metalevel" ~identifierPart
|
||||
|
|
|
@ -93,6 +93,10 @@ Facet.prototype.addAssertion = function(assertionFn) {
|
|||
return this.addEndpoint(new Endpoint(assertionFn, function(e) {}));
|
||||
};
|
||||
|
||||
Facet.prototype.addOnEventHandler = function(handler) {
|
||||
return this.addEndpoint(new Endpoint(function () { return Patch.emptyPatch; }, handler));
|
||||
};
|
||||
|
||||
Facet.prototype.onEvent = function(isTerminal, eventType, subscriptionFn, projectionFn, handlerFn) {
|
||||
var facet = this;
|
||||
switch (eventType) {
|
||||
|
|
Loading…
Reference in New Issue