diff --git a/lib/sequence/index.js b/lib/sequence/index.js index b1af7a6..0fe5de9 100644 --- a/lib/sequence/index.js +++ b/lib/sequence/index.js @@ -50,7 +50,12 @@ sequence.setStop = function () { sequence.stop = function () { sequence._state.active = false sequence._state.count = 0 + sequence._state.arr = [] + sequence._loop.count = 0 + sequence._loop.max = 0 + sequence._loop.arr = [] + if (sequence._state.stop) sequence._state.stop() sequence._state.stop = null } @@ -79,7 +84,7 @@ sequence.step = function () { sequence._state.count = 0 sequence._loop.count++ } - if (sequence._loop.count > sequence._loop.max) { + if (sequence._loop.max > 0 &&sequence._loop.count > sequence._loop.max) { return sequence.stop() } return sequence._loop.arr[sequence._state.count](() => {