Skip to content

Commit

Permalink
Do not dispatch event on destroyed flows
Browse files Browse the repository at this point in the history
If a tree falls in a forest
and no one is around to hear it,
does it make a sound?
  • Loading branch information
Adrian Sanchez committed Feb 15, 2018
1 parent d7a4068 commit e3a1595
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fluorine.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ Class('FlowNode').includes(NodeSupport)({
fulfill : function (data) {
this.data = data;
this.isFulfilled = true;

if (this.parent === null) {
return;
}

this.parent.dispatch(this.name);
},

Expand All @@ -268,6 +273,11 @@ Class('FlowNode').includes(NodeSupport)({
reject : function (error) {
this.error = error;
this.isRejected = true;

if (this.parent === null) {
return;
}

this.parent.dispatch(this.name);
this.parent.dispatch('reject', {
data : { node : this, error: error }
Expand Down

0 comments on commit e3a1595

Please sign in to comment.