From 46f6ec61055073925a67f6843b7fc049a92fb4c6 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 6 Sep 2017 20:29:16 +0300 Subject: [PATCH] added action attr defaults -- resolve in .__call__ if not found in target action... Signed-off-by: Alex A. Naanou --- actions.js | 15 +++++++++++++++ package.json | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/actions.js b/actions.js index c1fbe03..e334c50 100755 --- a/actions.js +++ b/actions.js @@ -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... diff --git a/package.json b/package.json index 14f765a..4c84a34 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ig-actions", - "version": "3.5.5", + "version": "3.6.0", "description": "", "main": "actions.js", "scripts": {