Files: 6151ce3e3718887750c939a25d0dec1f7d140794 / app / html / app.js
927 bytesRaw
1 | const nest = require('depnest') |
2 | const { h } = require('mutant') |
3 | |
4 | exports.gives = nest('app.html.app') |
5 | |
6 | exports.needs = nest({ |
7 | 'app.html.tabs': 'first', |
8 | 'app.page.errors': 'first', |
9 | 'app.sync.goTo': 'first', |
10 | 'app.sync.initialise': 'first', |
11 | 'app.sync.window': 'reduce', |
12 | 'history.obs.location': 'first', |
13 | 'history.sync.push': 'first', |
14 | 'settings.sync.get': 'first', |
15 | 'settings.sync.set': 'first' |
16 | }) |
17 | |
18 | exports.create = function (api) { |
19 | return nest('app.html.app', app) |
20 | |
21 | function app () { |
22 | console.log('STARTING app') |
23 | |
24 | window = api.app.sync.window(window) |
25 | |
26 | const initialTabs = ['/public', '/inbox', '/notifications'] // NB router converts these to { page: '/public' } |
27 | const App = h('App', api.app.html.tabs(initialTabs)) |
28 | |
29 | api.app.sync.initialise(App) |
30 | // runs all the functions in app/sync/initialise |
31 | |
32 | api.history.obs.location()(loc => api.app.sync.goTo(loc || {})) |
33 | |
34 | return App |
35 | } |
36 | } |
37 | |
38 |
Built with git-ssb-web