Files: c4c384106bcf50acf4c0fcb3f7b842ad68f25bcb / app / html / app.js
803 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 | 'history.obs.location': 'first', |
12 | 'history.sync.push': 'first', |
13 | 'settings.sync.get': 'first' |
14 | }) |
15 | |
16 | exports.create = function (api) { |
17 | return nest('app.html.app', app) |
18 | |
19 | function app (initialTabs) { |
20 | console.log('STARTING app') |
21 | |
22 | const App = h('App', api.app.html.tabs({ |
23 | initial: initialTabs || api.settings.sync.get('patchbay.defaultTabs') |
24 | })) |
25 | |
26 | api.app.sync.initialise(App) |
27 | // runs all the functions in app/sync/initialise |
28 | |
29 | api.history.obs.location()(loc => { |
30 | api.app.sync.goTo(loc || {}) |
31 | }) |
32 | |
33 | return App |
34 | } |
35 | } |
36 |
Built with git-ssb-web