From: Aleksander Ɓukasz Date: Tue, 22 Apr 2014 10:33:55 +0000 (+0200) Subject: fnpjs: actions - action returns via callback X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/07d6b62cad891ce2a51a60f81a6af00b73f3b9fe?hp=e6993e4bfe0e5fd38ccf554da489b5af3625c2fb fnpjs: actions - action returns via callback This allows asynchronous action execution --- diff --git a/src/fnpjs/actions.js b/src/fnpjs/actions.js index c49373a..f380ed6 100644 --- a/src/fnpjs/actions.js +++ b/src/fnpjs/actions.js @@ -72,10 +72,11 @@ _.extend(Action.prototype, Backbone.Events, { } return this._cache; }, - execute: function() { + execute: function(callback) { var state = this.getState(); + callback = callback || function() {}; if(state.allowed) { - return state.execute.call(this, this.params, this.appObject); + return state.execute.call(this, callback, this.params, this.appObject); } throw new Error('Execution not allowed'); }