|
|
|
@ -1,13 +1,16 @@
|
|
|
|
|
'use strict';
|
|
|
|
|
define(
|
|
|
|
|
[
|
|
|
|
|
'app',
|
|
|
|
|
'Commands/CommandModel',
|
|
|
|
|
'Commands/CommandCollection',
|
|
|
|
|
'underscore',
|
|
|
|
|
'jQuery/jquery.spin'
|
|
|
|
|
], function (CommandModel, CommandCollection, _) {
|
|
|
|
|
], function (App, CommandModel, CommandCollection, _) {
|
|
|
|
|
|
|
|
|
|
return{
|
|
|
|
|
var singleton = function () {
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
|
|
Execute: function (name, properties) {
|
|
|
|
|
|
|
|
|
@ -47,10 +50,17 @@ define(
|
|
|
|
|
model.bind('change:state', function (model) {
|
|
|
|
|
if (!model.isActive()) {
|
|
|
|
|
options.element.stopSpin();
|
|
|
|
|
|
|
|
|
|
if (model.isComplete()) {
|
|
|
|
|
App.vent.trigger(App.Events.CommandComplete, { command: model, model: options.model });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
options.element.startSpin();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return singleton();
|
|
|
|
|
});
|
|
|
|
|