Add import examples to readme
This commit is contained in:
parent
cc7b49d438
commit
0bb3bd4631
1 changed files with 12 additions and 2 deletions
14
readme.md
14
readme.md
|
@ -1,13 +1,15 @@
|
||||||
# Skooma
|
# Skooma
|
||||||
|
|
||||||
|
```js
|
||||||
|
import {html} from "skooma.js"
|
||||||
|
```
|
||||||
|
|
||||||
A functional-friendly helper library for procedural DOM generation and
|
A functional-friendly helper library for procedural DOM generation and
|
||||||
templating.
|
templating.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import {html} from "skooma.js"
|
|
||||||
|
|
||||||
document.body.append(html.div(
|
document.body.append(html.div(
|
||||||
html.h1("Hello, World!"),
|
html.h1("Hello, World!"),
|
||||||
html.p("Skooma is cool", {class: "amazing"}),
|
html.p("Skooma is cool", {class: "amazing"}),
|
||||||
|
@ -78,6 +80,10 @@ text`Hello, ${html.b(user)}!`
|
||||||
|
|
||||||
## bind
|
## bind
|
||||||
|
|
||||||
|
```js
|
||||||
|
import {bind} from 'skooma.js'
|
||||||
|
```
|
||||||
|
|
||||||
This function offers a generic mechanism for binding elements to dynamic state.
|
This function offers a generic mechanism for binding elements to dynamic state.
|
||||||
It takes a register function that satisfies the following criteria:
|
It takes a register function that satisfies the following criteria:
|
||||||
|
|
||||||
|
@ -105,6 +111,10 @@ even after several state changes.
|
||||||
|
|
||||||
## handle
|
## handle
|
||||||
|
|
||||||
|
```js
|
||||||
|
import {handle} from 'skooma.js'
|
||||||
|
```
|
||||||
|
|
||||||
Since it is common for event handlers to call `preventDefault()`, skooma
|
Since it is common for event handlers to call `preventDefault()`, skooma
|
||||||
provides a helper function called `handle` with the following definition:
|
provides a helper function called `handle` with the following definition:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue