mirror of
				https://github.com/flynx/object.js.git
				synced 2025-10-30 19:10:11 +00:00 
			
		
		
		
	docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									1f33e01c6a
								
							
						
					
					
						commit
						4e5ef568f4
					
				
							
								
								
									
										26
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								README.md
									
									
									
									
									
								
							| @ -227,13 +227,7 @@ var Action = object.Constructor('Action', | |||||||
| 		return this | 		return this | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| var action = new Action() | // a more flexible approach... | ||||||
| 
 |  | ||||||
| // the instance now is a function... |  | ||||||
| action() |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // a different way to do the above... |  | ||||||
| // | // | ||||||
| // This is the same as the above but a bit more convenient as we do  | // This is the same as the above but a bit more convenient as we do  | ||||||
| // not need to use Object.assign(..) or object.mixinFlat(..) to define | // not need to use Object.assign(..) or object.mixinFlat(..) to define | ||||||
| @ -245,6 +239,13 @@ var Action2 = object.Constructor('Action2', { | |||||||
| 	}, | 	}, | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | var action = Action() | ||||||
|  | var action2 = new Action2() | ||||||
|  | 
 | ||||||
|  | // the instances are now functions... | ||||||
|  | action() | ||||||
|  | action2() | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| In the above cases both the _function constructor_ and the `.__call__(..)`  | In the above cases both the _function constructor_ and the `.__call__(..)`  | ||||||
| @ -262,9 +263,14 @@ user's responsibility to call `.__call__(..)` method. | |||||||
| 
 | 
 | ||||||
| **Notes:** | **Notes:** | ||||||
| - the two approaches (_function_ vs. `.__call__(..)`) will produce  | - the two approaches (_function_ vs. `.__call__(..)`) will produce  | ||||||
|   slightly different results, the difference is in `.prototype`, in the |   functionally identical but structurally different constructors/objects,  | ||||||
|   first case it is a _function_ while in the second an object with a  |   the difference is in `.prototype`: | ||||||
|   `.__call__(..)` method.   | 
 | ||||||
|  |   	- _prototype function_ -> `.prototype` is a function object | ||||||
|  | 	- `.__call__(..)` -> `.prototype` object with a `.__call__(..)` method | ||||||
|  | 
 | ||||||
|  |   The instance in both cases is a function wrapper that will proxy the  | ||||||
|  |   call to the corresponding implementation. | ||||||
|   (this may change in the future) |   (this may change in the future) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user