mirror of
https://github.com/flynx/actions.js.git
synced 2025-12-19 01:21:39 +00:00
added .getActionAttrAliased(..)
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
fdf953d791
commit
47dac0a351
@ -517,6 +517,9 @@ Attribute access:
|
||||
<action-set>.getActionAttr('action', 'attr')
|
||||
-> <value>
|
||||
|
||||
<action-set>.getActionAttrAliased('action', 'attr')
|
||||
-> <value>
|
||||
|
||||
<action-set>.getRootActionAttr('action', 'attr')
|
||||
-> <value>
|
||||
```
|
||||
|
||||
23
actions.js
23
actions.js
@ -1048,6 +1048,29 @@ module.MetaActions = {
|
||||
if(cur[action] != null && action != '__actioncall__'){
|
||||
return this.getActionAttr('__actioncall__', attr) } },
|
||||
|
||||
// Get action attribute with alias support...
|
||||
//
|
||||
// An aliased attribute is one containing a string name of another
|
||||
// action.
|
||||
//
|
||||
// To avoid things changing when actions are added/removed this does
|
||||
// not support string attrubute values.
|
||||
getActionAttrAliased: function(action, attr){
|
||||
var value = action
|
||||
var seen = new Set()
|
||||
do {
|
||||
// recursive alias...
|
||||
if(seen.has(value)){
|
||||
throw new Error(
|
||||
'getActionAttrAliased: recursive alias for "'+ attr +'": '
|
||||
// XXX should we split seen at value???
|
||||
+ [...seen, value].join(' -> ')) }
|
||||
seen.add(value)
|
||||
// next value...
|
||||
value = this.getActionAttr(value, attr)
|
||||
} while(typeof(value) == 'string')
|
||||
return value },
|
||||
|
||||
// Get root action attribute value...
|
||||
//
|
||||
// This is similar to .getActionAttr(..) but will only chenck the
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-actions",
|
||||
"version": "3.24.30",
|
||||
"version": "3.25.0",
|
||||
"description": "",
|
||||
"main": "actions.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user