Detalhes do pacote

knack

zerobias566MIT0.0.3

Transparent async queue manager

queue, scheduler, load balancer, parallel

readme (leia-me)

knack

NPM version Unix Build Status Windows Build Status Coveralls Status Dependency Status

Knack transparently manages the execution of the asynchronous functions as a queue with a predetermined width

Knack simply wraps any promise-returning function and returns function, executed in a queue

Install

npm install --save knack

Usage

import Knack from 'knack'

function asyncFunc(param) {
  return Promise.resolve(param)
}

// All fields are optional
const knack = Knack({
  concurrency: 10,
  interval: 100,
  onDone: () => console.log('all tasks are done')
})

// Make wrapped function
const asyncQueued = knack(asyncFunc)
asyncQueued('ok')
// => Promise<'ok'>

// Or just make queue task executor
const task = knack.once()
task(asyncFunc, 'ok')
// => Promise<'ok'>

License

MIT © Zero Bias

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

0.0.3

  • Add CI
  • Add onDone (on empty queue and active list) handler

0.0.2

  • Add .once public method
  • Add changelog

0.0.1