mirror of
https://github.com/flynx/diff.js.git
synced 2025-10-29 02:50:10 +00:00
some more docs..
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e3c93d182e
commit
82f68b254f
@ -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 [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
|
## The Diff format
|
||||||
|
|
||||||
|
|||||||
6
diff.js
6
diff.js
@ -1662,6 +1662,12 @@ var DiffPrototype = {
|
|||||||
get version(){
|
get version(){
|
||||||
return this.constructor.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,
|
structure: null,
|
||||||
placeholders: null,
|
placeholders: null,
|
||||||
options: null,
|
options: null,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user