-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
47 lines (39 loc) · 1.22 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var html = require('choo/html')
var choo = require('choo')
var store = require('./app/store.js')
var storeButton = require('./app/components/storeButton.js')
var scribeButton = require('./app/components/scribeButton.js')
var scribeCanvas = require('./app/components/scribeCanvas.js')
var css = require('sheetify')
window.$ = require('jquery')
const TITLE = 'choo-scriber'
css('tachyons')
var app = choo()
app.use(store)
app.route('/', mainView)
app.route('/choo-scriber', mainView)
app.mount('body')
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register(`${window.location.href}sw.js`).then(registration => {
console.log('register service worker successfully')
}).catch(err => {
console.log(err)
})
})
}
function mainView (state, emit) {
if (state.title !== TITLE) emit(state.events.DOMTITLECHANGE, TITLE)
return html`
<body class='mv3 mh5'>
${storeButton.render(state, emit)}
<div class='flex'>
${scribeButton.render(state, emit)}
${scribeCanvas.render(state, emit)}
</div>
<a class='link blue' target='_blank' href='https://www.youtube.com/watch?v=ZVMYe-qiKlA'>
how to use
</a>
</body>
`
}