added .alias(..) action...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-08-03 22:05:53 +03:00
parent bb13399508
commit c9aac1e327
2 changed files with 18 additions and 6 deletions

View File

@ -643,15 +643,18 @@ function Alias(alias, target){
return new Alias(alias, target)
}
var parsed = typeof(target) == typeof('str') ? null : target
var doc = parsed ? parsed.doc : null
// XXX would be good to pre-parse the target...
var meth = Action(alias,
// XXX pre-parse the doc if possible...
null, null,
doc, null,
{ alias: target },
function(){
// parse the target...
var action = this.parseStringAction(target)
// XXX should we cache here???
var action = parsed || this.parseStringAction(target)
var args = action.arguments.slice()
// XXX merge args...
@ -718,6 +721,16 @@ module.MetaActions = {
parseStringAction: parseStringAction,
// XXX should this prevent overriding stuff???
// XXX move to a better spot...
alias: Action('alias', function(alias, target){
var parsed = typeof(target) == typeof('str') ?
this.parseStringAction(target)
: target
this[alias] = Alias(alias, parsed)
}),
// Get action attribute...
//
// NOTE: this will get attribute set both on the action object and
@ -1493,8 +1506,7 @@ module.MetaActions = {
// Remove a set of local mixed in actions from object...
//
mixoutFrom: function(to, options){
return this.mixout.call(to, this, options)
},
return this.mixout.call(to, this, options) },
// Create a child object...
//

View File

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