tree-diff
tree-diff copied to clipboard
diff tree nodes like React
tree-diff
diff tree nodes like React.
Demo
http://yiminghe.github.io/tree-diff
Api
diff(fromNodes: any[], afterNodes : any[], options = {}): Patch
options.shouldUpdate(node1, node2, node1Index, node2Index)
decide whether change node1 to node2 or detroy node1 and recreate node2
options.childrenKey="children"
children member name if node type is object
patch(patcher: Patcher, operations)
for example: src/dom/patchDOM.js
operations.processNew
how to process new node
operations.processRemove
how to process node removal
operations.processMove
how to process node move
operations.processUpdate
how to process node update