mirror of
				https://github.com/flynx/object.js.git
				synced 2025-11-03 21:10:08 +00:00 
			
		
		
		
	updated docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									b92af62a23
								
							
						
					
					
						commit
						af5acbd97e
					
				
							
								
								
									
										49
									
								
								object.js
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								object.js
									
									
									
									
									
								
							@ -320,16 +320,16 @@ function(context, constructor, ...args){
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
// The resulting constructor can produce objects in one of these ways:
 | 
					// The resulting constructor can produce objects in one of these ways:
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// 	Basic constructor use...
 | 
					// 	Create instance...
 | 
				
			||||||
// 		constructor()
 | 
					// 		constructor(..)
 | 
				
			||||||
// 		new constructor
 | 
					// 		new constructor
 | 
				
			||||||
// 		new constructor()
 | 
					// 		new constructor(..)
 | 
				
			||||||
// 			-> instance
 | 
					// 			-> instance
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// 	Pass arguments to the constructor...
 | 
					//	Create raw/uninitialized instance...
 | 
				
			||||||
// 		constructor(arg[, ...])
 | 
					//		constructor.__rawinstance__(..)
 | 
				
			||||||
// 		new constructor(arg[, ...])
 | 
					//		makeRawInstance(null, constructor, ..)
 | 
				
			||||||
// 			-> instance
 | 
					//			-> raw-instance
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// All produced objects are instances of the constructor
 | 
					// All produced objects are instances of the constructor
 | 
				
			||||||
@ -338,12 +338,13 @@ function(context, constructor, ...args){
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Init protocol:
 | 
					// Create and initialization protocol:
 | 
				
			||||||
// 	1) raw instance is created:
 | 
					// 	1) raw instance is created:
 | 
				
			||||||
// 		a) constructor.__rawinstance__(..) / makeRawInstance(..) called:
 | 
					// 		a) constructor.__rawinstance__(..) / makeRawInstance(..) called:
 | 
				
			||||||
// 			- call .__new__(..) if defined and get return value as instance, or
 | 
					// 			- call .__new__(..) if defined and get return value as 
 | 
				
			||||||
// 			- if .__call__(..) defined or prototype is a function, wrap it and
 | 
					// 				instance, or
 | 
				
			||||||
// 				use the wrapper function as instance, or
 | 
					// 			- if .__call__(..) defined or prototype is a function, wrap 
 | 
				
			||||||
 | 
					// 				it and use the wrapper function as instance, or
 | 
				
			||||||
// 			- create an empty object
 | 
					// 			- create an empty object
 | 
				
			||||||
// 		b) instance linked to prototype chain
 | 
					// 		b) instance linked to prototype chain
 | 
				
			||||||
// 			set .__proto__ to constructor.prototype
 | 
					// 			set .__proto__ to constructor.prototype
 | 
				
			||||||
@ -351,14 +352,35 @@ function(context, constructor, ...args){
 | 
				
			|||||||
// 		call .__init__(..) if defined
 | 
					// 		call .__init__(..) if defined
 | 
				
			||||||
// 
 | 
					// 
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 | 
					// 
 | 
				
			||||||
// Special methods (constructor):
 | 
					// Special methods (constructor):
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//  Handle uninitialized instance construction
 | 
				
			||||||
// 	.__rawinstance__(context, ...)
 | 
					// 	.__rawinstance__(context, ...)
 | 
				
			||||||
 | 
					// 		-> instance
 | 
				
			||||||
 | 
					// 		NOTE: This is a shorthand to makeRawInstance(..) see it for 
 | 
				
			||||||
 | 
					// 			details.
 | 
				
			||||||
// 
 | 
					// 
 | 
				
			||||||
// 
 | 
					// 
 | 
				
			||||||
// Special methods (.prototype):
 | 
					// Special methods (.prototype):
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// 	Create new instance object...
 | 
				
			||||||
// 	.__new__(context, ..)
 | 
					// 	.__new__(context, ..)
 | 
				
			||||||
 | 
					// 		-> object
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// 	Handle instance call...
 | 
				
			||||||
// 	.__call__(context, ..)
 | 
					// 	.__call__(context, ..)
 | 
				
			||||||
 | 
					// 		-> ..
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// 	Initialize instance object...
 | 
				
			||||||
// 	.__init__(..)
 | 
					// 	.__init__(..)
 | 
				
			||||||
 | 
					// 		-> ..
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// NOTE: raw instance creation is defined by makeRawInstance(..) so see 
 | 
				
			||||||
 | 
					// 		it for more info.
 | 
				
			||||||
 | 
					// NOTE: raw instance creation can be completely overloaded by defining
 | 
				
			||||||
 | 
					// 		.__rawinstance__(..) on the constructor. (XXX EXPERIMENTAL)
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
@ -406,11 +428,10 @@ function(context, constructor, ...args){
 | 
				
			|||||||
// NOTE: this sets the proto's .constructor attribute, thus rendering it
 | 
					// NOTE: this sets the proto's .constructor attribute, thus rendering it
 | 
				
			||||||
// 		not reusable, to use the same prototype for multiple objects clone
 | 
					// 		not reusable, to use the same prototype for multiple objects clone
 | 
				
			||||||
// 		it via. Object.create(..) or copy it...
 | 
					// 		it via. Object.create(..) or copy it...
 | 
				
			||||||
 | 
					// NOTE: to disable .__rawinstance__(..) handling set it to false in the 
 | 
				
			||||||
 | 
					// 		class prototype... (XXX EXPERIMENTAL)
 | 
				
			||||||
// 
 | 
					// 
 | 
				
			||||||
// XXX EXPERIMENTAL: calling .__rawinstance__(..) to create an instance...
 | 
					// XXX EXPERIMENTAL: calling .__rawinstance__(..) to create an instance...
 | 
				
			||||||
// NOTE: to disable .__rawinstance__(..) handling set it to false in the 
 | 
					 | 
				
			||||||
// 		class prototype...
 | 
					 | 
				
			||||||
// 
 | 
					 | 
				
			||||||
// XXX Q: should the context in .__new__(..) be _constructor or .prototype???
 | 
					// XXX Q: should the context in .__new__(..) be _constructor or .prototype???
 | 
				
			||||||
// 		...currently it's .prototype...
 | 
					// 		...currently it's .prototype...
 | 
				
			||||||
var Constructor = 
 | 
					var Constructor = 
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user