Skip to content

Commit

Permalink
Merge 17e5927 into b441c8d
Browse files Browse the repository at this point in the history
  • Loading branch information
philjones88 committed May 5, 2015
2 parents b441c8d + 17e5927 commit d512e66
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
13 changes: 13 additions & 0 deletions angular-poller.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,19 @@
reset: function () {
this.stopAll();
pollers = [];
},

/**
* Stop and removes a specific poller service
*/
remove: function (poller) {
for (var i = 0, len = pollers.length; i < len; i++) {
if (angular.equals(pollers[i], poller)) {
pollers[i].stop();
pollers.splice(i, 1);
break;
}
}
}
};
}
Expand Down
10 changes: 10 additions & 0 deletions test/angular-poller-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,16 @@ describe('emguo.poller', function () {
expect(poller2.interval).to.equal(undefined);
expect(poller.size()).to.equal(0);
});

it('should stop and remove a specific poller service on invoking remove().', function () {
poller.remove(poller1);
expect(poller.size()).to.equal(1);
});

it('should handle not finding a specific poller service on invoking remove().', function () {
poller.remove({});
expect(poller.size()).to.equal(2);
});
});
});

Expand Down

0 comments on commit d512e66

Please sign in to comment.