[WIP] A tiny Incremental DOM for modern browsers.
- Zero dependencies, only 2.15kb (gzipped)
- Incremental DOM / Virtuial DOM
Install
$ npm install --save tiny-dream # Or use yarn $ yarn add --dev tiny-dream
Usage
index.html
src/main.js
'app' App // initial renderingconst data = text: 'Hello World' // patch diff as if whole rendering
src/App.js (Component)
{ }
Example
For full examples, see example folder.
Legacy browsers support
See tiny-dream-es3. It works on IE8+.
API
There are only 7 APIs.
new TinyDream(id, component)
Initialize application by id with component.
tagOpen(tagName[, attributesArray, key])
Create open tag like <div>
.
The key
is used when searching and rendering lists for the best performance.
tagClose(tagName)
Create close tag like </div>
.
tagVoid(tagName[, attributesArray, key])
Create (empty) tag node like <input>
.
The key
is used when searching and rendering lists for the best performance.
text(text)
Create text node.
component(component, data)
Create custom component (and pass data).
patch(data)
Render whole incremental dom and patch only actual diffs to the real dom.