Push dev work to master #2
16
index.js
16
index.js
|
@ -304,11 +304,10 @@ function rSequence (req, res, next) {
|
|||
}
|
||||
}
|
||||
if (intval._state.sequence && sequence._state.active) {
|
||||
return sequence.setStop(() => {
|
||||
intval._state.sequence = false
|
||||
res.send({ stopped : true })
|
||||
return next()
|
||||
})
|
||||
sequence.setStop()
|
||||
intval._state.sequence = false
|
||||
res.send({ stopped : true })
|
||||
return next()
|
||||
} else {
|
||||
console.time('sequence time')
|
||||
intval._state.sequence = true
|
||||
|
@ -488,10 +487,9 @@ function seq () {
|
|||
|
||||
if (intval._state.sequence && sequence._state.active) {
|
||||
log.info('sequence', { method : 'release' , stop: true })
|
||||
return sequence.setStop(() => {
|
||||
intval._state.sequence = false
|
||||
return cb()
|
||||
})
|
||||
sequence.setStop()
|
||||
intval._state.sequence = false
|
||||
return cb()
|
||||
} else {
|
||||
console.time('sequence time')
|
||||
log.info('sequence', { method : 'release', start : true })
|
||||
|
|
|
@ -43,9 +43,8 @@ sequence.start = function (options, cb) {
|
|||
sequence.step()
|
||||
}
|
||||
|
||||
sequence.setStop = function (cb) {
|
||||
sequence.setStop = function () {
|
||||
sequence._state.active = false
|
||||
sequence._state.input = cb
|
||||
}
|
||||
|
||||
sequence.stop = function () {
|
||||
|
@ -58,10 +57,8 @@ sequence.stop = function () {
|
|||
sequence._loop.arr = []
|
||||
|
||||
if (sequence._state.stop) sequence._state.stop()
|
||||
if (sequence._state.input) sequence._state.input()
|
||||
|
||||
sequence._state.stop = null
|
||||
sequence._state.input = null
|
||||
}
|
||||
|
||||
sequence.pause = function () {
|
||||
|
@ -74,7 +71,6 @@ sequence.resume = function () {
|
|||
}
|
||||
|
||||
sequence.step = function () {
|
||||
log.info('step', `Started step ${sequence._state.count}`)
|
||||
if (sequence._state.active && !sequence._state.paused) {
|
||||
if (sequence._state.arr.length > 0) {
|
||||
if (sequence._state.count > sequence._state.arr.length - 1) {
|
||||
|
|
Loading…
Reference in New Issue