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