Skip to content

Commit

Permalink
docs(readme): add maquette example
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed Sep 2, 2016
1 parent f909a5c commit 2c482fd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Expand Up @@ -120,6 +120,25 @@ The `virtualDOMPatcher` function argument gives the to ability to customize how
}
```

3. [view maquette demo](https://esnextb.in/?gist=3d01659f63f914882340e4173d5d273d)

```js
import {h, createProjector} from 'maquette'

function virtualDOMPatcher (root) {
let __vNode
const projector = createProjector()
const render = () => projector.append(root, () => __vNode)
return function (vNode) {
if(!__vNode) {
__vNode = vNode
render()
}
__vNode = vNode
}
}
```

## Dispatching Custom Events
For components to communicate with the outside world the component can dispatch a [CustomEvent] via the `update()` function.

Expand Down
19 changes: 19 additions & 0 deletions docs/README.template.md
Expand Up @@ -120,6 +120,25 @@ The `virtualDOMPatcher` function argument gives the to ability to customize how
}
```

3. [view maquette demo](https://esnextb.in/?gist=3d01659f63f914882340e4173d5d273d)

```js
import {h, createProjector} from 'maquette'

function virtualDOMPatcher (root) {
let __vNode
const projector = createProjector()
const render = () => projector.append(root, () => __vNode)
return function (vNode) {
if(!__vNode) {
__vNode = vNode
render()
}
__vNode = vNode
}
}
```

## Dispatching Custom Events
For components to communicate with the outside world the component can dispatch a [CustomEvent] via the `update()` function.

Expand Down

0 comments on commit 2c482fd

Please sign in to comment.