awesome hooking everything up

This commit is contained in:
Peter Cottle 2013-01-06 23:50:52 -08:00
parent 378fcc0377
commit 0735eb3d64
11 changed files with 266 additions and 139 deletions

View file

@ -149,6 +149,14 @@ var Sandbox = Backbone.View.extend({
deferred.resolve();
},
showLevels: function(command, deferred) {
var whenClosed = Q.defer();
Main.getLevelDropdown().show(whenClosed);
whenClosed.promise.done(function() {
command.finishWith(deferred);
});
},
processSandboxCommand: function(command, deferred) {
var commandMap = {
'help': this.helpDialog,
@ -157,7 +165,8 @@ var Sandbox = Backbone.View.extend({
'clear': this.clear,
'exit level': this.exitLevel,
'level': this.startLevel,
'sandbox': this.exitLevel
'sandbox': this.exitLevel,
'levels': this.showLevels
};
var method = commandMap[command.get('method')];
if (!method) { throw new Error('no method for that wut'); }