Files: 2b05be8ee023fdd9580d6a845ba074a425756685 / app / sync / start.js
897 bytesRaw
1 | const nest = require('depnest') |
2 | |
3 | exports.gives = nest('app.sync.start') |
4 | |
5 | exports.needs = nest({ |
6 | 'app.html.app': 'first', |
7 | 'app.page.errors': 'first', |
8 | 'app.sync.goTo': 'first', |
9 | 'app.sync.initialise': 'first', |
10 | 'config.sync.load': 'first', |
11 | 'history.obs.location': 'first', |
12 | 'history.sync.push': 'first', |
13 | 'settings.sync.get': 'first', |
14 | 'sbot.async.run': 'first' |
15 | }) |
16 | |
17 | exports.create = function (api) { |
18 | return nest('app.sync.start', start) |
19 | |
20 | function start (opts = {}) { |
21 | console.log('STARTING Patchbay UI') |
22 | |
23 | const App = api.app.html.app(opts.initialTabs) |
24 | |
25 | api.app.sync.initialise(App, api.config.sync.load()) |
26 | // runs all the functions in app/sync/initialise |
27 | |
28 | api.history.obs.location()(api.app.sync.goTo) |
29 | |
30 | api.sbot.async.run(server => { |
31 | server.whoami((err, data) => { |
32 | if (err) throw err |
33 | document.body.appendChild(App) |
34 | }) |
35 | }) |
36 | } |
37 | } |
38 |
Built with git-ssb-web