mirror of
				https://github.com/flynx/object.js.git
				synced 2025-10-31 03:20:09 +00:00 
			
		
		
		
	docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									a341443b07
								
							
						
					
					
						commit
						df90a282fe
					
				
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
								
							| @ -281,22 +281,30 @@ var utilityMixin = { | |||||||
| 
 | 
 | ||||||
| var Base = object.Constructor('Base')  | var Base = object.Constructor('Base')  | ||||||
| 
 | 
 | ||||||
|  | // normal instance prototype chain: | ||||||
|  | //	b -> Base.prototype -> ..  | ||||||
|  | // | ||||||
|  | var b = Base() | ||||||
| 
 | 
 | ||||||
| // mixin directly into the instance... | // mixin directly into the instance... | ||||||
| var m = object.mixin(Base(), utilityMixin) | // | ||||||
|  | // now the prototype chain looks like this: | ||||||
|  | //	b -> mixinFlat({}, utilityMixin) -> Base.prototype -> .. | ||||||
|  | // | ||||||
|  | object.mixin(b, utilityMixin) | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| `.mixin(..)` will copy the contents of `utilityMixin` into the prototype  | `.mixin(..)` will copy the contents of `utilityMixin` into the prototype  | ||||||
| chain between `m` and `m.__proto__`. | chain between `b` and `b.__proto__`. | ||||||
| 
 | 
 | ||||||
| We can also remove the mixin... | We can also remove the mixin... | ||||||
| ```javascript | ```javascript | ||||||
| m = o.mixout(m, utilityMixin) | o.mixout(b, utilityMixin) | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| The mixed-in data is removed iff an object is found in the chain with the | The mixed-in data is removed iff a [matching](#match) object is found in  | ||||||
| same attributes as `utilityMixin` and with each attribute matching | the chain with the same attributes as `utilityMixin` and with each  | ||||||
| identity with the corresponding attribute in the mixin. | attribute matching identity with the corresponding attribute in the mixin. | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| Constructor-based mixin... | Constructor-based mixin... | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user