mirror of
https://github.com/flynx/actions.js.git
synced 2025-10-28 18:00:11 +00:00
removed .apply(..) and added experimental .chain(..)..
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
040d839511
commit
8e82ed7526
16
actions.js
16
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...
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-actions",
|
||||
"version": "3.24.28",
|
||||
"version": "3.24.29",
|
||||
"description": "",
|
||||
"main": "actions.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user