Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,24 @@ Idiomorph.morph(document.documentElement, newPageSource, {head:{style: 'morph'}}

The `head` object also offers callbacks for configuring head merging specifics.

### Plugins

Idiomorph supports a plugin system that allows you to extend the functionality of the library, by adding an object of callbacks:

```js
Idiomorph.addPlugin({
name: 'logger',
beforeNodeAdded: function(node) {
console.log('Node added:', node);
},
beforeNodeRemoved: function(node) {
console.log('Node removed:', node);
},
});
```

These callbacks will be called in addition to any other callbacks that are registered in `Idiomorph.morph`. Multiple plugins can be added.

### Setting Defaults

All the behaviors specified above can be set to a different default by mutating the `Idiomorph.defaults` object, including
Expand Down
Loading