diff --git a/README.md b/README.md index b4fd6ff..ccbf085 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/diff.js b/diff.js index 8311a6d..ad4e13f 100644 --- a/diff.js +++ b/diff.js @@ -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,