mirror of
				https://github.com/flynx/object.js.git
				synced 2025-10-30 19:10:11 +00:00 
			
		
		
		
	added special methods to docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									ff5e4e0eba
								
							
						
					
					
						commit
						c454f48b3d
					
				
							
								
								
									
										73
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										73
									
								
								README.md
									
									
									
									
									
								
							| @ -125,6 +125,10 @@ class B extends A { | |||||||
| 		- [Extending the constructor](#extending-the-constructor) | 		- [Extending the constructor](#extending-the-constructor) | ||||||
| 		- [Inheriting from native constructor objects](#inheriting-from-native-constructor-objects) | 		- [Inheriting from native constructor objects](#inheriting-from-native-constructor-objects) | ||||||
| 		- [Extending native `.constructor(..)`](#extending-native-constructor) | 		- [Extending native `.constructor(..)`](#extending-native-constructor) | ||||||
|  | 	- [Special methods](#special-methods) | ||||||
|  | 		- [`<object>.__new__(..)`](#object__new__) | ||||||
|  | 		- [`<object>.__init__(..)`](#object__init__) | ||||||
|  | 		- [`<object>.__call__(..)`](#object__call__) | ||||||
| 	- [Components](#components) | 	- [Components](#components) | ||||||
| 		- [`STOP`](#stop) | 		- [`STOP`](#stop) | ||||||
| 		- [`sources(..)`](#sources) | 		- [`sources(..)`](#sources) | ||||||
| @ -141,9 +145,12 @@ class B extends A { | |||||||
| 		- [`Constructor(..)` / `C(..)`](#constructor--c) | 		- [`Constructor(..)` / `C(..)`](#constructor--c) | ||||||
| 	- [Utilities](#utilities) | 	- [Utilities](#utilities) | ||||||
| 		- [`normalizeIndent(..)` / `normalizeTextIndent(..)`](#normalizeindent--normalizetextindent) | 		- [`normalizeIndent(..)` / `normalizeTextIndent(..)`](#normalizeindent--normalizetextindent) | ||||||
|  | 		- [`deepKeys(..)`](#deepkeys) | ||||||
| 		- [`match(..)`](#match) | 		- [`match(..)`](#match) | ||||||
|  | 		- [`matchPartial(..)`](#matchpartial) | ||||||
| 	- [Limitations](#limitations) | 	- [Limitations](#limitations) | ||||||
| 		- [Can not mix unrelated native types](#can-not-mix-unrelated-native-types) | 		- [Can not mix unrelated native types](#can-not-mix-unrelated-native-types) | ||||||
|  | 	- [More](#more) | ||||||
| 	- [License](#license) | 	- [License](#license) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -220,9 +227,9 @@ var Item = object.Constructor('Item', Base, { | |||||||
| 		return object.parentCall(Item.prototype, 'method', this, ...arguments) | 		return object.parentCall(Item.prototype, 'method', this, ...arguments) | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	__init__: function(){ | 	__init__: function(...args){ | ||||||
| 		// call the "super" method... | 		// call the "super" method... | ||||||
| 		object.parentCall(this.__init__, this, ...arguments) | 		object.parentCall(this.__init__, this, ...args) | ||||||
| 
 | 
 | ||||||
| 		this.item_attr = 'instance attribute value' | 		this.item_attr = 'instance attribute value' | ||||||
| 	}, | 	}, | ||||||
| @ -475,6 +482,58 @@ var myArray = object.Constructor('myArray', Array, { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | ## Special methods | ||||||
|  | 
 | ||||||
|  | ### `<object>.__new__(..)` | ||||||
|  | 
 | ||||||
|  | Create new instance object. | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | <object>.__new__(<context>, ..) | ||||||
|  | 	-> <instance> | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | This is called in the context of `<constructor>` as at time of call  | ||||||
|  | no instance exists yet.  | ||||||
|  | 
 | ||||||
|  | `<context>` is the _outer_ context of the call, i.e. the object from which  | ||||||
|  | `<constructor>` was referenced before it was called. | ||||||
|  | 
 | ||||||
|  | For more info see:  | ||||||
|  | - [Low level constructor](#low-level-constructor),  | ||||||
|  | - [Inheriting from native constructor objects](#inheriting-from-native-constructor-objects) | ||||||
|  | - [Extending native `.constructor(..)`](#extending-native-constructor) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | ### `<object>.__init__(..)` | ||||||
|  | 
 | ||||||
|  | Initialize the instance. | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | <object>.__init__(..) | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Return value is ignored. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | ### `<object>.__call__(..)` | ||||||
|  | 
 | ||||||
|  | Call the object. | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | <object>.__call__(<context>, ..) | ||||||
|  | 	-> <result> | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | This is called in the context of `<object>`.  | ||||||
|  | 
 | ||||||
|  | `<context>` is the _outer_ context of the call, i.e. the object from which  | ||||||
|  | `<object>` was referenced before it was called. | ||||||
|  | 
 | ||||||
|  | For more info see: [Callable instances](#callable-instances) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ## Components | ## Components | ||||||
| 
 | 
 | ||||||
| Note that all of the following are generic and will work on any relevant | Note that all of the following are generic and will work on any relevant | ||||||
| @ -487,7 +546,6 @@ var l = object.RawInstance(null, Array, 'a', 'b', 'c') | |||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| ### `STOP` | ### `STOP` | ||||||
| 
 | 
 | ||||||
| Used in [`sources(..)`](#sources), [`values(..)`](#values) and  | Used in [`sources(..)`](#sources), [`values(..)`](#values) and  | ||||||
| @ -580,9 +638,9 @@ values(<object>, '__call__', ..) | |||||||
| This will return the callable objects themselves or the value of `.__call__`. | This will return the callable objects themselves or the value of `.__call__`. | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| See [`sources(..)`](#sources) for docs on `callback(..)` and special cases. | See [`sources(..)`](#sources) for docs on `callback(..)` and special cases. | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| ### `parent(..)` | ### `parent(..)` | ||||||
| 
 | 
 | ||||||
| Get parent attribute value or method | Get parent attribute value or method | ||||||
| @ -835,6 +893,7 @@ normalizeTextIndent(..) | |||||||
| 
 | 
 | ||||||
| This ignores `object.LEADING_TABS` and `leading_tabs` is 0 by default. | This ignores `object.LEADING_TABS` and `leading_tabs` is 0 by default. | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| ### `deepKeys(..)` | ### `deepKeys(..)` | ||||||
| 
 | 
 | ||||||
| ``` | ``` | ||||||
| @ -934,6 +993,12 @@ Still, this is worth some thought. | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | ## More | ||||||
|  | 
 | ||||||
|  | For more info see the [source...](./object.js) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ## License | ## License | ||||||
| 
 | 
 | ||||||
| [BSD 3-Clause License](./LICENSE) | [BSD 3-Clause License](./LICENSE) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user