Hoist .refresh out from .handleEvent; makes assertions depend on state that might have been changed in event handlers properly.

This commit is contained in:
Tony Garnock-Jones 2016-05-12 17:37:14 -04:00
parent a433a054b8
commit 6d305e6b00
1 changed files with 3 additions and 1 deletions

View File

@ -31,6 +31,9 @@ Actor.prototype.handleEvent = function(e) {
this.facets.forEach(function (f) {
withCurrentFacet(f, function () { f.handleEvent(e); });
});
this.facets.forEach(function (f) {
withCurrentFacet(f, function () { f.refresh(); });
});
this.checkForTermination();
};
@ -84,7 +87,6 @@ Facet.prototype.handleEvent = function(e) {
facet.endpoints.forEach(function(endpoint) {
endpoint.handlerFn.call(facet.actor.state, e);
});
facet.refresh();
};
Facet.prototype.addAssertion = function(assertionFn) {