Moved commands to a separate file.

This commit is contained in:
Borys Levytskyi
2015-04-04 19:00:08 +03:00
parent 383062905e
commit 9744f88c3d
5 changed files with 47 additions and 44 deletions

25
app/commandsCatalog.js Normal file
View File

@@ -0,0 +1,25 @@
app.run(function() {
var dispatcher = app.get('dispatcher');
dispatcher.commands({
'help': function() {
return new app.models.HelpResult();
},
'clear': function() {
app.controller('resultViewCtrl').clear();
},
'em': function() {
var cfg = app.get('cmdConfig');
cfg.emphasizeBytes = !cfg.cmdConfig.emphasizeBytes;
}
});
// TODO: Make as function
dispatcher.command({
canHandle: function(input) { return app.get('expression').canParse(input); },
handle: function(input) {
return app.get('expression').parse(input);
}
});
});