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