2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-09-11 06:33:47 +00:00
|
|
|
define(
|
|
|
|
[
|
|
|
|
'Commands/CommandModel',
|
|
|
|
'Commands/CommandCollection',
|
|
|
|
'underscore'
|
|
|
|
], function (CommandModel, CommandCollection, _) {
|
2013-05-11 23:39:32 +00:00
|
|
|
|
2013-09-11 06:33:47 +00:00
|
|
|
return{
|
|
|
|
Execute: function (name, properties) {
|
|
|
|
|
|
|
|
var attr = _.extend({name: name.toLocaleLowerCase()}, properties);
|
2013-06-13 02:55:11 +00:00
|
|
|
|
2013-09-11 06:33:47 +00:00
|
|
|
var commandModel = new CommandModel(attr);
|
|
|
|
|
|
|
|
return commandModel.save().success(function () {
|
|
|
|
CommandCollection.add(commandModel);
|
|
|
|
});
|
|
|
|
}
|
2013-06-13 02:55:11 +00:00
|
|
|
}
|
2013-06-24 23:41:59 +00:00
|
|
|
});
|