Skip to content

Commit

Permalink
Allow to use triggersEnter in Group without Array
Browse files Browse the repository at this point in the history
 - Allow to use triggersEnter in Group without Array, see [PR
kadirahq#659](kadirahq#659)
  • Loading branch information
dr-dimitru committed Feb 23, 2017
1 parent 7660ca7 commit c4e6bba
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions client/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ Group = function(router, options = {}, parent) {
this.name = options.name;
this.options = options;

this._triggersEnter = [];
this._triggersEnter = this._triggersEnter || [];
if (options.triggersEnter) {
this._triggersEnter.concat(options.triggersEnter);
if (!_.isArray(options.triggersEnter)) {
options.triggersEnter = [options.triggersEnter];
}
this._triggersEnter = this._triggersEnter.concat(options.triggersEnter);
}
this._triggersExit = [];
if (options._triggersExit) {
this._triggersExit.concat(options._triggersExit);

this._triggersExit = this._triggersExit || [];
if (options.triggersExit) {
if (!_.isArray(options.triggersExit)) {
options.triggersExit = [options.triggersExit];
}
this._triggersExit = this._triggersExit.concat(options.triggersExit);
}

this._subscriptions = options.subscriptions || Function.prototype;

this.parent = parent;
Expand Down

0 comments on commit c4e6bba

Please sign in to comment.