This commit is contained in:
Peter Cottle 2013-01-05 12:50:29 -08:00
parent d5f456fa0c
commit 6ee05c1f0a
6 changed files with 102 additions and 33 deletions
src/js/level

View file

@ -82,7 +82,6 @@ var Sandbox = Backbone.View.extend({
Main.getEvents().trigger('commandSubmittedPassive', value);
util.splitTextCommand(value, function(command) {
console.log('adding command', command);
this.commandCollection.add(new Command({
rawStr: command,
parseWaterfall: this.parseWaterfall
@ -94,7 +93,8 @@ var Sandbox = Backbone.View.extend({
var commandMap = {
help: this.helpDialog,
reset: this.reset,
delay: this.delay
delay: this.delay,
clear: this.clear
};
var method = commandMap[command.get('method')];
if (!method) { throw new Error('no method for that wut'); }
@ -102,6 +102,11 @@ var Sandbox = Backbone.View.extend({
method.apply(this, [command, deferred]);
},
clear: function(command, deferred) {
Main.getEvents().trigger('clearOldCommands');
command.finishWith(deferred);
},
delay: function(command, deferred) {
var amount = parseInt(command.get('regexResults')[1], 10);
setTimeout(function() {