fnpjs: Action now triggers actionExecuted event instead of using callback
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 2 Jul 2014 07:50:16 +0000 (09:50 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 18 Jul 2014 09:20:27 +0000 (11:20 +0200)
src/fnpjs/actions.js

index f380ed6..b8aa033 100644 (file)
@@ -72,9 +72,13 @@ _.extend(Action.prototype, Backbone.Events, {
         }
         return this._cache;
     },
         }
         return this._cache;
     },
-    execute: function(callback) {
+    execute: function() {
         var state = this.getState();
         var state = this.getState();
-        callback = callback || function() {};
+        
+        var callback = function(ret) {
+            this.trigger('actionExecuted', ret);
+        }.bind(this);
+
         if(state.allowed) {
             return state.execute.call(this, callback, this.params, this.appObject);
         }
         if(state.allowed) {
             return state.execute.call(this, callback, this.params, this.appObject);
         }