git ssb

16+

Dominic / patchbay



Tree: d3a0c5e302f7edc7a52b5002d4c9ad4f2a2d4df3

Files: d3a0c5e302f7edc7a52b5002d4c9ad4f2a2d4df3 / app / sync / goTo.js

536 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})
9
10exports.create = function (api) {
11 return nest('app.sync.goTo', function goTo (location, change) {
12 const tabs = api.app.html.tabs()
13
14 const locationSignature = JSON.stringify(location)
15
16 if (tabs.has(locationSignature)) {
17 tabs.select(locationSignature)
18 return true
19 }
20
21 api.app.sync.addPage(location, true, false)
22 return change
23 })
24}
25
26

Built with git-ssb-web