Job Queue for serial processing of tasks in apps like LiveReload

npm install jobqueue
2 downloads in the last day
10 downloads in the last week
19 downloads in the last month

Job Queue

Work in progress. The API should look like:

queue.register { step: 'postproc' },
  # attributes that comprise the job ID; requests with identical IDs are merged into a single job
  id: ['project', 'step']

  # merge oldRequest into newRequest; by default, all array attributes are merged;
  # ID attributes are guaranteed to be equal
  merge: (newRequest, oldRequest) ->

  execute: (request, emit) ->
    @add type: 'warning', file: '/foo'
    @done null

queue.add { project:, step: 'postproc', paths: paths }

# value triggering (remove existing jobs with this scope, then add new ones)
queue.update { project:, step: 'postproc' }, { paths: [paths] }
queue.update { project:, step: 'compile' }, [{src: '/path/to/src'}, {src: '/another/src'}]

queue.cancel { project: }

Work in progress.


Copyright 2012, Andrey Tarantsov. Distributed under the MIT license.

npm loves you