I have seen questions like this but they do not answer my question.
I have a function
var kue = require('kue');
var jobs = kue.createQueue();
var create_job = function(data, callback){
jobs.create('job', {
stuff: data
}).save();
}
How can I make it so that callback
is called when jobs.process('job', function(job, done){ ...
is finished?
I've not used kue before, so this is going off their documentation:
I've created/used a JavaScript closure to capture the value of the
callback
argument (by attaching the events within the scope of thecreate_job
function, and it's later called when the function completes (or fails).