git ssb

16+

Dominic / patchbay



Tree: 9510d7867738dfa7a4aaee17c183c86bb081f55e

Files: 9510d7867738dfa7a4aaee17c183c86bb081f55e / app / sync / goTo.js

602 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
28

Built with git-ssb-web