@f/queue

Simple function queue

Stats

StarsIssuesVersionUpdatedCreatedSize
@f/queue
101.0.26 years ago6 years agoMinified + gzip package size for @f/queue in KB

Readme

queue

Build status Git tag NPM version Code style

Simple function queue

Installation

$ npm install @f/queue

Usage

var createQueue = require('@f/queue')
var queue = createQueue()

queue.push(function () {
  console.log('hello world')
})

queue.flush()

Or in ES6:

import createQueue from '@f/queue'

const {add, flush} = createQueue()
add(() => console.log('hello world'))

setTimeout(flush)

API

queue()

Returns: An object containing two functions, add and flush:

  • add(fn) - Add fn to the queue.
  • flush() - Flush the queue - i.e., run all the fns, clear the queue, and return an array of their return values.

Note that queue does not use a prototype, so you can call flush and add without invoking them on the queue object.

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.