some more docs..

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-07-31 02:46:58 +03:00
parent e3c93d182e
commit 82f68b254f
2 changed files with 13 additions and 0 deletions

View File

@ -336,6 +336,13 @@ ExtendedDiff.types.delete('Text')
The [source code](./diff.js#L1098) is a good example for this as the base `Diff(..)` is built using this API, but note that we are registering types on the `Types` object rather than on the `Diff` itself, there is no functional difference other than how the main code is structured internally.
The handler methods are all called in the context of the `Diff.types` object.
To call a different type handler's methods use:
```javascript
this.typeCall(HandlerType, 'method', ...args)
```
For an example see: `Object` handler's `.walk(..)` in [diff.js](./diff.js#L1178).
## The Diff format

View File

@ -1662,6 +1662,12 @@ var DiffPrototype = {
get version(){
return this.constructor.version },
// XXX is this the right thing to do???
// ...the bad thing here is that this can be mutated from the
// instance when returned like this...
get types(){
return this.constructor.type },
structure: null,
placeholders: null,
options: null,