Skip to content
A simple async queue to do an action one at a time
JavaScript
Find file
Latest commit 9df19f0 @Raynos Update package.json
Failed to load latest commit information.
examples no comment before tap version
test cleaned up examples and tests
.gitignore initial
.testem.json initial
.travis.yml initial
LICENCE
README.md bump
index.js
package.json Update package.json

README.md

push-queue

build status

browser support

A simple async queue to do an action one at a time

Example

var assert = require("assert")
var setTimeout = require("timers").setTimeout

var Queue = require("push-queue")

var started = false

var enqueue = Queue(function (item, callback) {
    assert.equal(started, false)
    started = true

    console.log("doing", item)

    setTimeout(function () {
        console.log("finished", item)
        assert.equal(started, true)
        started = false
        callback()
    }, 100)
})

enqueue("one")
enqueue("two")
enqueue("three")

Installation

npm install push-queue

Contributors

  • Raynos

MIT Licenced

Something went wrong with that request. Please try again.