From 78a47e91ace7d47c2e9f7feb3602b30a14927a85 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 10 Dec 2020 05:17:10 +0300 Subject: [PATCH] now can pass the action itself to introspection function... Signed-off-by: Alex A. Naanou --- actions.js | 32 ++++++++++++++++++++++++++------ package.json | 2 +- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/actions.js b/actions.js index 4342cb6..bdf5030 100755 --- a/actions.js +++ b/actions.js @@ -1007,6 +1007,9 @@ module.MetaActions = { // XXX add option to to enable/disable look in .__actioncall__... getActionAttr: function(action, attr){ var cur = this + action = typeof(action) == 'function' ? + action.name + : action // go up the proto chain... while(cur.__proto__ != null){ @@ -1042,6 +1045,9 @@ module.MetaActions = { // base Action object is checked (Action.prototype.await)... getRootActionAttr: function(action, attr){ var cur = this + action = typeof(action) == 'function' ? + action.name + : action // go up the proto chain... while(cur.__proto__ != null){ @@ -1074,14 +1080,21 @@ module.MetaActions = { getDoc: function(actions){ var res = {} var that = this - actions = actions == null ? this.actions - : arguments.length > 1 ? [...arguments] - : typeof(actions) == typeof('str') ? [actions] + actions = actions == null ? + this.actions + : arguments.length > 1 ? + [...arguments] + : (typeof(actions) == typeof('str') + || typeof(actions) == 'function') ? + [actions] : actions // get the first defined set of docs in the inheritance chain... actions.forEach(function(n){ var cur = that + n = typeof(n) == 'function' ? + n.name + : n res[n] = [] // go up the proto chain... while(cur.__proto__ != null){ @@ -1094,14 +1107,21 @@ module.MetaActions = { getPath: function(actions){ var res = {} var that = this - actions = actions == null ? this.actions - : arguments.length > 1 ? [...arguments] - : typeof(actions) == typeof('str') ? [actions] + actions = actions == null ? + this.actions + : arguments.length > 1 ? + [...arguments] + : (typeof(actions) == typeof('str') + || typeof(actions) == 'function') ? + [actions] : actions // get the first defined set of docs in the inheritance chain... actions.forEach(function(n){ var cur = that + n = typeof(n) == 'function' ? + n.name + : n // go up the proto chain... while(cur.__proto__ != null){ if(cur[n] != null && cur[n].doc != null){ diff --git a/package.json b/package.json index 5070648..b3f5bf8 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-actions", - "version": "3.24.21", + "version": "3.24.22", "description": "", "main": "actions.js", "scripts": {