now can pass the action itself to introspection function...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-10 05:17:10 +03:00
parent 2f8250d75d
commit 78a47e91ac
2 changed files with 27 additions and 7 deletions

View File

@ -1007,6 +1007,9 @@ module.MetaActions = {
// XXX add option to to enable/disable look in .__actioncall__... // XXX add option to to enable/disable look in .__actioncall__...
getActionAttr: function(action, attr){ getActionAttr: function(action, attr){
var cur = this var cur = this
action = typeof(action) == 'function' ?
action.name
: action
// go up the proto chain... // go up the proto chain...
while(cur.__proto__ != null){ while(cur.__proto__ != null){
@ -1042,6 +1045,9 @@ module.MetaActions = {
// base Action object is checked (Action.prototype.await)... // base Action object is checked (Action.prototype.await)...
getRootActionAttr: function(action, attr){ getRootActionAttr: function(action, attr){
var cur = this var cur = this
action = typeof(action) == 'function' ?
action.name
: action
// go up the proto chain... // go up the proto chain...
while(cur.__proto__ != null){ while(cur.__proto__ != null){
@ -1074,14 +1080,21 @@ module.MetaActions = {
getDoc: function(actions){ getDoc: function(actions){
var res = {} var res = {}
var that = this var that = this
actions = actions == null ? this.actions actions = actions == null ?
: arguments.length > 1 ? [...arguments] this.actions
: typeof(actions) == typeof('str') ? [actions] : arguments.length > 1 ?
[...arguments]
: (typeof(actions) == typeof('str')
|| typeof(actions) == 'function') ?
[actions]
: actions : actions
// get the first defined set of docs in the inheritance chain... // get the first defined set of docs in the inheritance chain...
actions.forEach(function(n){ actions.forEach(function(n){
var cur = that var cur = that
n = typeof(n) == 'function' ?
n.name
: n
res[n] = [] res[n] = []
// go up the proto chain... // go up the proto chain...
while(cur.__proto__ != null){ while(cur.__proto__ != null){
@ -1094,14 +1107,21 @@ module.MetaActions = {
getPath: function(actions){ getPath: function(actions){
var res = {} var res = {}
var that = this var that = this
actions = actions == null ? this.actions actions = actions == null ?
: arguments.length > 1 ? [...arguments] this.actions
: typeof(actions) == typeof('str') ? [actions] : arguments.length > 1 ?
[...arguments]
: (typeof(actions) == typeof('str')
|| typeof(actions) == 'function') ?
[actions]
: actions : actions
// get the first defined set of docs in the inheritance chain... // get the first defined set of docs in the inheritance chain...
actions.forEach(function(n){ actions.forEach(function(n){
var cur = that var cur = that
n = typeof(n) == 'function' ?
n.name
: n
// go up the proto chain... // go up the proto chain...
while(cur.__proto__ != null){ while(cur.__proto__ != null){
if(cur[n] != null && cur[n].doc != null){ if(cur[n] != null && cur[n].doc != null){

View File

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