models: sturdify namespaces

This commit is contained in:
Yoshua Wuyts
2016-05-23 03:32:14 +09:00
parent 0be2337605
commit 24b9be7c8d
4 changed files with 77 additions and 47 deletions
+12 -11
View File
@@ -66,16 +66,18 @@ app.model({
}
})
const mainView = (params, state, send) => choo.view`
<main class="app">
<h1>${state.title}</h1>
<label>Set the title</label>
<input
type="text"
placeholder=${state.input.title}
oninput=${(e) => send('input:update', { payload: e.target.value })}>
</main>
`
const mainView = (params, state, send) => {
return choo.view`
<main class="app">
<h1>${state.input.title}</h1>
<label>Set the title</label>
<input
type="text"
placeholder=${state.input.title}
oninput=${(e) => send('input:update', { payload: e.target.value })}>
</main>
`
}
app.router((route) => [
route('/', mainView)
@@ -240,7 +242,6 @@ choo.model({
})
```
### Server Sent Events (SSE)
[Server Sent Events (SSE)][sse] allow servers to push data to the browser.
They're the unidirectional cousin of `websockets` and compliment `HTTP`