Created
August 20, 2012 09:43
-
-
Save frankrousseau/3402705 to your computer and use it in GitHub Desktop.
Kue demo snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kue = require 'kue' | |
jobs = kue.createQueue() | |
Job = kue.Job | |
kue.app.listen 3003 | |
job = jobs.create("test complete", | |
title: "my test" | |
info: "job is working" | |
).save() | |
job.on 'progress', (progress) -> | |
console.log job.data.title + ' #' + job.id + ' ' + progress + '% complete' | |
job.on 'complete', () -> | |
console.log job.data.title + " #" + job.id + " complete" | |
jobs.process "test complete", 1, (myjob, done) -> | |
console.log myjob.data.title + " #" + myjob.id + " job started" | |
setTimeout -> | |
console.log myjob.data.info | |
myjob.progress 50, 100 | |
setTimeout -> | |
done() | |
, 2000 | |
, 2000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment