mirror of
				https://github.com/flynx/actions.js.git
				synced 2025-10-31 03:10:09 +00:00 
			
		
		
		
	started work on action aliases...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									f0ebd06257
								
							
						
					
					
						commit
						7b900cf6c6
					
				
							
								
								
									
										45
									
								
								actions.js
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								actions.js
									
									
									
									
									
								
							| @ -592,6 +592,41 @@ Action.prototype.chainCall = function(context, inner){ | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //---------------------------------------------------------------------
 | ||||
| 
 | ||||
| // XXX handle alias args and pass them to the target...
 | ||||
| var Alias = | ||||
| module.Alias = | ||||
| function Alias(alias, target){ | ||||
| 	// we got called without a 'new'...
 | ||||
| 	if(this == null || this.constructor !== Alias){ | ||||
| 		// XXX using something like .apply(.., arguemnts) would be more
 | ||||
| 		// 		generel but have no time to figure out how to pass it 
 | ||||
| 		// 		to new without the later complaining...
 | ||||
| 		return new Alias(alias, target) | ||||
| 	} | ||||
| 
 | ||||
| 	var meth = Action(alias, doc, null,  | ||||
| 		{ alias: target },  | ||||
| 		function(){ | ||||
| 			// XXX parse the target...
 | ||||
| 			// XXX
 | ||||
| 
 | ||||
| 			// XXX merge args...
 | ||||
| 			// XXX
 | ||||
| 
 | ||||
| 			// XXX call the alias...
 | ||||
| 			// XXX
 | ||||
| 		}) | ||||
| 	meth.__proto__ = this.__proto__ | ||||
| 
 | ||||
| 	return meth | ||||
| } | ||||
| // inherit from Action...
 | ||||
| Alias.prototype.__proto__ = Action.prototype | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| //---------------------------------------------------------------------
 | ||||
| 
 | ||||
| // A base action-set object...
 | ||||
| @ -628,6 +663,16 @@ module.MetaActions = { | ||||
| 		return res | ||||
| 	}, | ||||
| 
 | ||||
| 	// 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???
 | ||||
| 	get aliases(){ | ||||
| 		var that = this | ||||
| 		return this.actions | ||||
| 			.filter(function(n){ return that[name] instanceof Alias }) }, | ||||
| 
 | ||||
| 
 | ||||
| 	// Get action attribute...
 | ||||
| 	//
 | ||||
| 	// NOTE: this will get attribute set both on the action object and 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user