git ssb

16+

Dominic / patchbay



Tree: b51d7758237b262870685f4987822ea751f33200

Files: b51d7758237b262870685f4987822ea751f33200 / app / sync / goTo.js

601 bytesRaw
1const nest = require('depnest')
2
3exports.gives = nest({ 'app.sync.goTo': true })
4
5exports.needs = nest({
6 'app.html.tabs': 'first',
7 'app.sync.addPage': 'first',
8 'router.sync.normalise': 'first'
9})
10
11exports.create = function (api) {
12 return nest('app.sync.goTo', function goTo (location, change) {
13 const tabs = api.app.html.tabs()
14
15 location = api.router.sync.normalise(location)
16 const locationId = JSON.stringify(location)
17
18 if (tabs.has(locationId)) {
19 tabs.select(locationId)
20 return true
21 }
22
23 api.app.sync.addPage(location, true, false)
24 return change
25 })
26}
27

Built with git-ssb-web