removed .apply(..) and added experimental .chain(..)..

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-19 18:16:57 +03:00
parent 040d839511
commit 8e82ed7526
2 changed files with 13 additions and 5 deletions

View File

@ -934,12 +934,20 @@ module.MetaActions = {
// XXX EXPERIMENTAL... // XXX EXPERIMENTAL...
call: function(action, ...args){ call: function(action, ...args){
return action instanceof Function ? return action instanceof Function ?
action.apply(this, args) action.call(this, ...args)
: this[action] ? : this[action] ?
this[action].apply(this, args) this[action](...args)
: this.parseStringAction.callAction(this, action, ...args) }, : this.parseStringAction.callAction(this, action, ...args) },
apply: function(action, args){ // XXX EXPERIMENTAL -- symantics of this are not final...
return this.call(action, ...args)}, 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... // Set/remove action alias...

View File

@ -1,6 +1,6 @@
{ {
"name": "ig-actions", "name": "ig-actions",
"version": "3.24.28", "version": "3.24.29",
"description": "", "description": "",
"main": "actions.js", "main": "actions.js",
"scripts": { "scripts": {