added action attr defaults -- resolve in .__call__ if not found in target action...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-09-06 20:29:16 +03:00
parent b23247f6c2
commit 46f6ec6105
2 changed files with 16 additions and 1 deletions

View File

@ -873,6 +873,13 @@ module.MetaActions = {
// Get action attribute...
//
// Attribute search order (return first matching):
// - Local action
// - Local action.function (.func)
// - repeat for .__proto__ (until top of MRO)
// - repeat for '__call__' special action (XXX EXPERIMENTAL)
//
//
// NOTE: this will get attribute set both on the action object and
// the action function, this covers two usecases:
// 1) action constructor attributes...
@ -889,6 +896,9 @@ module.MetaActions = {
// ...
// someAction: ['...',
// modifyAction(function(){ ... })],
//
// XXX document...
// XXX add option to to enable/disable look in .__call__...
getActionAttr: function(action, attr){
var cur = this
@ -906,6 +916,11 @@ module.MetaActions = {
}
cur = cur.__proto__
}
// search .__call__ action...
if(action != '__call__'){
return this.getActionAttr('__call__', attr)
}
},
// Get action documentation...

View File

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