Files: feaef7416161fe384b1f54730d4ed4ef362082ba / app / html / app.js
916 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 | }) |
16 | |
17 | exports.create = function (api) { |
18 | return nest('app.html.app', app) |
19 | |
20 | function app (initialTabs) { |
21 | console.log('STARTING app') |
22 | |
23 | window = api.app.sync.window(window) // eslint-disable-line no-global-assign |
24 | |
25 | const App = h('App', api.app.html.tabs({ |
26 | initial: initialTabs || api.settings.sync.get('patchbay.defaultTabs') |
27 | })) |
28 | |
29 | api.app.sync.initialise(App) |
30 | // runs all the functions in app/sync/initialise |
31 | |
32 | api.history.obs.location()(loc => { |
33 | api.app.sync.goTo(loc || {}) |
34 | }) |
35 | |
36 | return App |
37 | } |
38 | } |
39 |
Built with git-ssb-web