mirror of
https://github.com/flynx/actions.js.git
synced 2025-10-28 18:00:11 +00:00
now .aliases list only own aliases + docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
bf0c6de223
commit
f3dab4c3d3
51
actions.js
51
actions.js
@ -83,6 +83,14 @@ module.UNDEFINED = ['undefined placeholder']
|
||||
// - post action handlers will get the root action result as first
|
||||
// argument succeeded by the action arguments.
|
||||
//
|
||||
// Alias
|
||||
// - an action created by Alias(..),
|
||||
// - identical to an action with one key difference: instead of a
|
||||
// function Alias(..) expects a string/code,
|
||||
// - code syntax is configurable, defaulting to the defined by
|
||||
// parseActionCall(..)
|
||||
// - aliases are designed to be defined and managed in runtime while
|
||||
// actions are mainly load-time entities.
|
||||
//
|
||||
//
|
||||
// The action system main protocols:
|
||||
@ -240,6 +248,40 @@ module.UNDEFINED = ['undefined placeholder']
|
||||
//
|
||||
//
|
||||
//
|
||||
// Alias protocols:
|
||||
//
|
||||
// 1) Defining aliases in runtime (MetaActions)
|
||||
//
|
||||
// <action-set>.alias('alias', 'action: args')
|
||||
// <action-set>.alias('alias', .., 'action: args')
|
||||
// -> <action-set>
|
||||
//
|
||||
// NOTE: .alias(..) is signature compatible to Action(..) / Alias(..),
|
||||
// supporting all the documentation and attribute definition.
|
||||
//
|
||||
//
|
||||
// 2) Deleting aliases in runtime (MetaActions)
|
||||
//
|
||||
// <action-set>.alias('alias', null)
|
||||
// <action-set>.alias('alias', false)
|
||||
// -> <action-set>
|
||||
//
|
||||
// NOTE: only own aliases can be deleted via .alias(.., null|false)
|
||||
//
|
||||
//
|
||||
// 3) Documentation generation and introspection (MetaActions, Alias)
|
||||
//
|
||||
// Alias code...
|
||||
// <alias>.alias
|
||||
// <alias>.toString()
|
||||
// -> <code>
|
||||
//
|
||||
// List own aliases...
|
||||
// <action-set>.aliases
|
||||
// -> <action-set>
|
||||
//
|
||||
//
|
||||
//
|
||||
/*********************************************************************/
|
||||
// helpers...
|
||||
|
||||
@ -774,13 +816,14 @@ module.MetaActions = {
|
||||
},
|
||||
|
||||
// List aliases...
|
||||
// XXX should the check be deep???
|
||||
// ...i.e. we can extend an alias with an action, does this make
|
||||
// the extending action an alias???
|
||||
//
|
||||
// NOTE: this will only show the aliases local to this.
|
||||
get aliases(){
|
||||
var that = this
|
||||
return this.actions
|
||||
.filter(function(n){ return that[n] instanceof Alias }) },
|
||||
.filter(function(n){
|
||||
return Object.hasOwnProperty(this, n)
|
||||
&& that[n] instanceof Alias }) },
|
||||
|
||||
|
||||
// XXX move this to the right spot...
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-actions",
|
||||
"version": "3.5.2",
|
||||
"version": "3.5.3",
|
||||
"description": "",
|
||||
"main": "actions.js",
|
||||
"scripts": {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user