added .source_tag to Actions methods (experimental)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-03-05 00:24:18 +03:00
parent da0923343f
commit d9c819025d
2 changed files with 16 additions and 6 deletions

View File

@ -1719,6 +1719,7 @@ module.MetaActions = {
// NOTE: this will override existing own attributes. // NOTE: this will override existing own attributes.
// //
// XXX should we include functions by default???? // XXX should we include functions by default????
// XXX should .source_tag be set here or in Actions(..)???
inlineMixin: function(from, options){ inlineMixin: function(from, options){
// defaults... // defaults...
options = options || {} options = options || {}
@ -1766,21 +1767,29 @@ module.MetaActions = {
} }
// source tag actions... // 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... // 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 return
// new tag... // new tag...
// XXX not sure if this is the right way to go... // 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' 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' +' to: "'+source_tag+'"\n'
+' on:', that[k]) +' on:', that[k])
} }
if(that[k].func){
that[k].func.source_tag = source_tag that[k].func.source_tag = source_tag
}
that[k].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 add doc, ldoc, tags and save them to each action...
// XXX is .config processing correct here??? // XXX is .config processing correct here???
// XXX do we need to handle methods in a special way??? // XXX do we need to handle methods in a special way???
// XXX should this set the .source_tag???
var Actions = var Actions =
module.Actions = module.Actions =
function Actions(a, b){ function Actions(a, b){

View File

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