Created
October 17, 2012 07:23
-
-
Save kuno/3904197 to your computer and use it in GitHub Desktop.
maki-queue usage example
This file contains 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
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