-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.jsx
More file actions
30 lines (26 loc) · 803 Bytes
/
index.jsx
File metadata and controls
30 lines (26 loc) · 803 Bytes
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
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import EventEmitter from 'events'
import {render, h} from 'preact'
import viewStore from './stores/view'
import feedStore from './stores/feed'
import feedLogStore from './stores/feed-log'
import inspectorStore from './stores/inspector'
import focusStore from './stores/focus'
import urlStore from './stores/url'
import Main from './views/main'
const state = {}
const bus = new EventEmitter()
bus.STATE_CHANGE = Symbol('state change')
const emit = bus.emit.bind(bus)
viewStore(state, bus)
feedStore(state, bus)
feedLogStore(state, bus)
inspectorStore(state, bus)
focusStore(state, bus)
urlStore(state, bus)
const rerender = () => {
render(<Main state={state} emit={emit} />, document.body)
}
bus.on(bus.STATE_CHANGE, rerender)
rerender()