mirror of
https://github.com/flynx/actions.js.git
synced 2025-10-29 02:10:09 +00:00
now .getActionAttr(..) searches both the action and it's function...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e86836d95f
commit
eab204e36a
26
actions.js
26
actions.js
@ -630,14 +630,36 @@ module.MetaActions = {
|
|||||||
|
|
||||||
// Get action attribute...
|
// Get action attribute...
|
||||||
//
|
//
|
||||||
|
// NOTE: this will get attribute set both on the action object and
|
||||||
|
// the action function, this covers two usecases:
|
||||||
|
// 1) action constructor attributes...
|
||||||
|
// someAction: ['...',
|
||||||
|
// // action attribute...
|
||||||
|
// {attr: 'value'},
|
||||||
|
// function(){ ... }],
|
||||||
|
// 2) action modifiers...
|
||||||
|
// var modifyAction = function(func){
|
||||||
|
// // function attribute...
|
||||||
|
// func.attr = 'value'
|
||||||
|
// return func
|
||||||
|
// }
|
||||||
|
// ...
|
||||||
|
// someAction: ['...',
|
||||||
|
// modifyAction(function(){ ... })],
|
||||||
getActionAttr: function(action, attr){
|
getActionAttr: function(action, attr){
|
||||||
var cur = this
|
var cur = this
|
||||||
|
|
||||||
// go up the proto chain...
|
// go up the proto chain...
|
||||||
while(cur.__proto__ != null){
|
while(cur.__proto__ != null){
|
||||||
//if(cur[action] != null && attr in cur[action]){
|
if(cur[action] != null){
|
||||||
if(cur[action] != null && cur[action][attr] !== undefined){
|
// attribute of action...
|
||||||
|
if(cur[action][attr] !== undefined){
|
||||||
return cur[action][attr]
|
return cur[action][attr]
|
||||||
|
|
||||||
|
// attribute of action function...
|
||||||
|
} else if(cur[action].func && cur[action].func[attr] !== undefined){
|
||||||
|
return cur[action].func[attr]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cur = cur.__proto__
|
cur = cur.__proto__
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-actions",
|
"name": "ig-actions",
|
||||||
"version": "3.1.1",
|
"version": "3.1.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "actions.js",
|
"main": "actions.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user