Skip to content

Instantly share code, notes, and snippets.

@kuno
Created October 17, 2012 07:23
Show Gist options
  • Save kuno/3904197 to your computer and use it in GitHub Desktop.
Save kuno/3904197 to your computer and use it in GitHub Desktop.
maki-queue usage example
var Model = Bones.plugin.models.Server;
var Backend = Bones.plugin.backends.Queue;
var server = new Model({id:'lorem'});
var queue = new Backend(server, {
error: function() {
// When an error occurs
},
success: function() {
// When all tasks were finished
},
progress: function() {
// When one task was finished
}
});
var commands = [
...
{
command: {
command: 'echo',
args: [
'Lorem ipsum dolor sit amet'
],
options: {}
}
},
{
command: {
command: 'echo',
args: [
'Lorem ipsum dolor sit amet'
],
options: {}
}
},
...
];
queue.add(commands);
// Commit the queue to the controller.
queue.commit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment