Files: a20d5059cc43f723aefd7fe6e3a79aa751ded3a9 / app / html / app.js
960 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 | 'router.sync.router': 'first', |
15 | 'settings.sync.get': 'first', |
16 | 'settings.sync.set': 'first' |
17 | }) |
18 | |
19 | exports.create = function (api) { |
20 | return nest('app.html.app', app) |
21 | |
22 | function app () { |
23 | console.log('STARTING app') |
24 | |
25 | window = api.app.sync.window(window) |
26 | |
27 | const initialTabs = ['/public', '/inbox', '/notifications'] // NB router converts these to { page: '/public' } |
28 | const App = h('App', api.app.html.tabs(initialTabs)) |
29 | |
30 | api.app.sync.initialise(App) |
31 | // runs all the functions in app/sync/initialise |
32 | |
33 | api.history.obs.location()(loc => api.app.sync.goTo(loc || {})) |
34 | |
35 | return App |
36 | } |
37 | } |
38 | |
39 |
Built with git-ssb-web