git ssb

1+

dinoworm ๐Ÿ› / catstack



Tree: 224ba37003f0c72d7a782bb20e5f96d4bfb61b5b

Files: 224ba37003f0c72d7a782bb20e5f96d4bfb61b5b / browser.js

1088 bytesRaw
1const pull = require('pull-stream')
2const combine = require('depject')
3const { entry } = require('inu')
4const start = require('inu-engine')
5
6const configModule = require('./config')
7const appModules = require('./lib/app')
8const coreModules = require('./modules')
9
10// TODO this should be a depject module,
11// but first need to refactor this inu
12// code to work as such, using something
13// like: https://github.com/depject/depject/issues/26
14
15module.exports = startBrowser
16
17function startBrowser () {
18 const sockets = combine(
19 configModule,
20 appModules(),
21 coreModules
22 )
23
24 const cssRender = sockets.css.render[0]
25 const htmlUpdate = sockets.html.update[0]
26
27 const styles = document.createElement('style')
28 document.head.appendChild(styles)
29 console.log('sockets', sockets)
30 cssRender(styles)
31
32 const store = entry(sockets)
33 const { views, dispatch } = start(store)
34
35 // HACK inject dispatch
36 sockets.inu.dispatch.push(dispatch)
37
38 const main = document.createElement('div')
39 document.body.appendChild(main)
40
41 pull(views(), pull.drain(htmlUpdate.bind(null, main)))
42}
43

Built with git-ssb-web