From d9c819025d9be8b656a7934273605a5389fc7434 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 5 Mar 2018 00:24:18 +0300 Subject: [PATCH] added .source_tag to Actions methods (experimental)... Signed-off-by: Alex A. Naanou --- actions.js | 20 +++++++++++++++----- package.json | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/actions.js b/actions.js index bc9fdf9..8d99624 100755 --- a/actions.js +++ b/actions.js @@ -1719,6 +1719,7 @@ module.MetaActions = { // NOTE: this will override existing own attributes. // // XXX should we include functions by default???? + // XXX should .source_tag be set here or in Actions(..)??? inlineMixin: function(from, options){ // defaults... options = options || {} @@ -1766,21 +1767,29 @@ module.MetaActions = { } // source tag actions... - if(source_tag && attr instanceof Action){ + // XXX should this set action and method .source_tag or only action??? + //if(source_tag && attr instanceof Action){ + if(source_tag && (attr instanceof Action || attr instanceof Function)){ // existing tag... - if(that[k].source_tag == source_tag || that[k].func.source_tag == source_tag){ + if(that[k].source_tag == source_tag + || (that[k].func || {}).source_tag == source_tag){ return // new tag... // XXX not sure if this is the right way to go... - } else if(that[k].source_tag || that[k].func.source_tag){ + } else if(that[k].source_tag + || (that[k].func || {}).source_tag){ console.warn('Aactions: about to overwrite source tag...\n' - +' from: "'+(that[k].source_tag || that[k].func.source_tag)+'"\n' + +' from: "' + +(that[k].source_tag + || (that[k].func || {}).source_tag)+'"\n' +' to: "'+source_tag+'"\n' +' on:', that[k]) } - that[k].func.source_tag = source_tag + if(that[k].func){ + that[k].func.source_tag = source_tag + } that[k].source_tag = source_tag } } @@ -2113,6 +2122,7 @@ object.makeConstructor('ActionSet', MetaActions) // XXX add doc, ldoc, tags and save them to each action... // XXX is .config processing correct here??? // XXX do we need to handle methods in a special way??? +// XXX should this set the .source_tag??? var Actions = module.Actions = function Actions(a, b){ diff --git a/package.json b/package.json index 38c3ff4..ba5159c 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-actions", - "version": "3.18.0", + "version": "3.19.0", "description": "", "main": "actions.js", "scripts": {