public/build/static/application.js
function(method, args, options) {
            var that = this, methodHandler;

            options = options || {};

            var handler = this.getHandler(method);
            if (!handler) return Q.reject(new Error("No handler found for method: "+method));

            // Is offline
            if (!Offline.isConnected()) {
                methodHandler = handler.fallback;
            }
            methodHandler = methodHandler || handler.execute || this.defaultHandler.execute;

            // No default
            if (!methodHandler) {
                return Q.reject(new Error("No handler found for this method in this backend"));
            }

            return Q(methodHandler(args, options, method)).then(function(results) {
                if (handler.after) {
                    return Q.all([
                        Q(handler.after(args, results, options, method)),
                        Q((that.defaultHandler.after || function() {})(args, results, options, method))
                    ]).then(function() {
                        return Q(results);
                    }, function() {
                        return Q(results);
                    });
                }
                return results;
            });
        }
function(method, args, options) {
            var that = this, methodHandler;

            options = options || {};

            var handler = this.getHandler(method);
            if (!handler) return Q.reject(new Error("No handler found for method: "+method));

            // Is offline
            if (!Offline.isConnected()) {
                methodHandler = handler.fallback;
            }
            methodHandler = methodHandler || handler.execute || this.defaultHandler.execute;

            // No default
            if (!methodHandler) {
                return Q.reject(new Error("No handler found for this method in this backend"));
            }

            return Q(methodHandler(args, options, method)).then(function(results) {
                if (handler.after) {
                    return Q.all([
                        Q(handler.after(args, results, options, method)),
                        Q((that.defaultHandler.after || function() {})(args, results, options, method))
                    ]).then(function() {
                        return Q(results);
                    }, function() {
                        return Q(results);
                    });
                }
                return results;
            });
        }
function ( method , args , options ) { var that = this , methodHandler ; options = options || { } ; var handler = this . getHandler ( method ) ; if ( ! handler ) return Q . reject ( new Error ( "No handler found for method: " + method ) ) ; // Is offline if ( ! Offline . isConnected ( ) ) { methodHandler = handler . fallback ; } methodHandler = methodHandler || handler . execute || this . defaultHandler . execute ; // No default if ( ! methodHandler ) { return Q . reject ( new Error ( "No handler found for this method in this backend" ) ) ; } return Q ( methodHandler ( args , options , method ) ) . then ( function ( results ) { if ( handler . after ) { return Q . all ( [ Q ( handler . after ( args , results , options , method ) ) , Q ( ( that . defaultHandler . after || function ( ) { } ) ( args , results , options , method ) ) ] ) . then ( function ( ) { return Q ( results ) ; } , function ( ) { return Q ( results ) ; } ) ; } return results ; } ) ; }
Execute a method

@method execute
@param {string} method name of the method to execute
@param {object} args arguments for this method
@param {options} [options] options for execution
@return {promise<object>}
Execute a method