Command Queue
Command queues have not much on their shoulders so far: they just trigger the "commandPushed
" & "commandRemoved
" events when commands are pushed into or removed from them.
Note: Command pattern implementation is based on command-pattern.
Example
var queue = new CommandQueue();
queue.when("commandPushed", function(command) {
// Well... do something, please! For example:
command.execute(function(error, results) {
queue.remove(command);
});
});
queue.when("commandRemoved", function() {
// There you could do something as well.
});