This repository has been archived on 2020-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
Syllabus/themes/piratecare/node_modules/fastq/test/example.ts

38 lines
526 B
TypeScript

import * as fastq from '../'
const queue = fastq({ hello: 'world' }, worker, 1)
queue.push(42, (err, done) => {
if (err) throw err
console.log('the result is', done)
})
queue.concurrency
queue.drain()
queue.empty = () => undefined
queue.idle()
queue.kill()
queue.killAndDrain()
queue.length
queue.pause()
queue.resume()
queue.saturated = () => undefined
queue.unshift(42, (err, done) => {
if (err) throw err
console.log('the result is', done)
})
function worker(arg: any, cb: any) {
cb(null, 42 * 2)
}