A simple async queue to do an action one at a time
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
test
.gitignore
.testem.json
.travis.yml
LICENCE
README.md
index.js
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