Skip to content

Commit 45c6b3c

Browse files
authored
Expose paused status flag (#91)
* Expose paused status flag * Fix legacy tests
1 parent 571b25b commit 45c6b3c

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ each time a task is completed, `err` will be not null if the task has thrown an
233233
Property that returns the number of concurrent tasks that could be executed in
234234
parallel. It can be altered at runtime.
235235

236+
-------------------------------------------------------
237+
<a name="paused"></a>
238+
### queue.paused
239+
240+
Property (Read-Only) that returns `true` when the queue is in a paused state.
241+
236242
-------------------------------------------------------
237243
<a name="drain"></a>
238244
### queue.drain

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ declare namespace fastq {
2020
killAndDrain(): any
2121
error(handler: errorHandler<T>): void
2222
concurrency: number
23+
readonly paused: boolean
2324
drain(): any
2425
empty: () => void
2526
saturated: () => void

test/test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,3 +640,14 @@ test('pause/resume should trigger drain event', function (t) {
640640

641641
queue.resume()
642642
})
643+
644+
test('paused flag', function (t) {
645+
t.plan(2)
646+
647+
var queue = buildQueue(function (arg, cb) {
648+
cb(null)
649+
}, 1)
650+
t.equal(queue.paused, false)
651+
queue.pause()
652+
t.equal(queue.paused, true)
653+
})

0 commit comments

Comments
 (0)