Skip to content

Commit

Permalink
multitimer throws on too many stops
Browse files Browse the repository at this point in the history
  • Loading branch information
polotek committed Aug 12, 2012
1 parent ed01c7a commit 446e149
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/timers.js
Expand Up @@ -16,8 +16,11 @@ exports.multiTimer = function(stops, delay, msg) {
var t = exports.timer(delay, msg)
t._stop = t.stop
t.stop = function() {
if(!--stops) {
--stops
if(stops === 0) {
t._stop()
} else if (stops < 0) {
throw new Error('Too many timer stops')
}
}

Expand Down

0 comments on commit 446e149

Please sign in to comment.