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