diff --git a/README.md b/README.md index e7dc612..9e6ef00 100755 --- a/README.md +++ b/README.md @@ -125,6 +125,10 @@ class B extends A { - [Extending the constructor](#extending-the-constructor) - [Inheriting from native constructor objects](#inheriting-from-native-constructor-objects) - [Extending native `.constructor(..)`](#extending-native-constructor) + - [Special methods](#special-methods) + - [`.__new__(..)`](#object__new__) + - [`.__init__(..)`](#object__init__) + - [`.__call__(..)`](#object__call__) - [Components](#components) - [`STOP`](#stop) - [`sources(..)`](#sources) @@ -141,9 +145,12 @@ class B extends A { - [`Constructor(..)` / `C(..)`](#constructor--c) - [Utilities](#utilities) - [`normalizeIndent(..)` / `normalizeTextIndent(..)`](#normalizeindent--normalizetextindent) + - [`deepKeys(..)`](#deepkeys) - [`match(..)`](#match) + - [`matchPartial(..)`](#matchpartial) - [Limitations](#limitations) - [Can not mix unrelated native types](#can-not-mix-unrelated-native-types) + - [More](#more) - [License](#license) @@ -220,9 +227,9 @@ var Item = object.Constructor('Item', Base, { return object.parentCall(Item.prototype, 'method', this, ...arguments) }, - __init__: function(){ + __init__: function(...args){ // call the "super" method... - object.parentCall(this.__init__, this, ...arguments) + object.parentCall(this.__init__, this, ...args) this.item_attr = 'instance attribute value' }, @@ -475,6 +482,58 @@ var myArray = object.Constructor('myArray', Array, { +## Special methods + +### `.__new__(..)` + +Create new instance object. + +``` +.__new__(, ..) + -> +``` + +This is called in the context of `` as at time of call +no instance exists yet. + +`` is the _outer_ context of the call, i.e. the object from which +`` 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) + + +### `.__init__(..)` + +Initialize the instance. + +``` +.__init__(..) +``` + +Return value is ignored. + + +### `.__call__(..)` + +Call the object. + +``` +.__call__(, ..) + -> +``` + +This is called in the context of ``. + +`` is the _outer_ context of the call, i.e. the object from which +`` was referenced before it was called. + +For more info see: [Callable instances](#callable-instances) + + + ## Components 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` Used in [`sources(..)`](#sources), [`values(..)`](#values) and @@ -580,9 +638,9 @@ values(, '__call__', ..) This will return the callable objects themselves or the value of `.__call__`. - See [`sources(..)`](#sources) for docs on `callback(..)` and special cases. + ### `parent(..)` Get parent attribute value or method @@ -835,6 +893,7 @@ normalizeTextIndent(..) This ignores `object.LEADING_TABS` and `leading_tabs` is 0 by default. + ### `deepKeys(..)` ``` @@ -934,6 +993,12 @@ Still, this is worth some thought. +## More + +For more info see the [source...](./object.js) + + + ## License [BSD 3-Clause License](./LICENSE)