examples: add sse

This commit is contained in:
Yoshua Wuyts
2016-06-20 23:51:29 +01:00
parent bae31831fe
commit 9486df4725
5 changed files with 130 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
const choo = require('../../../')
module.exports = function (params, state, send) {
const error = state.app.error[0]
const title = state.api.title
return choo.view`
<section>
<h1>${title}</h1>
<h2>Latest error: ${error}</h2>
<button onclick=${(e) => send('api:good')}>OK!</button>
<button onclick=${(e) => send('api:bad')}>Naughty</button>
</section>
`
}