diff --git a/actions.js b/actions.js index 6f03069..1b52175 100755 --- a/actions.js +++ b/actions.js @@ -934,12 +934,20 @@ module.MetaActions = { // XXX EXPERIMENTAL... call: function(action, ...args){ return action instanceof Function ? - action.apply(this, args) + action.call(this, ...args) : this[action] ? - this[action].apply(this, args) + this[action](...args) : this.parseStringAction.callAction(this, action, ...args) }, - apply: function(action, args){ - return this.call(action, ...args)}, + // XXX EXPERIMENTAL -- symantics of this are not final... + chain: function(actions, ...args){ + var that = this + actions + .reduce(function(res, action){ + return res instanceof Promise ? + res + .then(function(res){ + return that.call(action, res, ...args) }) + : that.call(action, res, ...args) }, that) }, // Set/remove action alias... diff --git a/package.json b/package.json index 54bc4c0..d420833 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-actions", - "version": "3.24.28", + "version": "3.24.29", "description": "", "main": "actions.js", "scripts": {