Files: b7d7f86afc99c01161ac2e00a2decf8ecb85246e / app / sync / addPage.js
553 bytesRaw
1 | const nest = require('depnest') |
2 | |
3 | exports.gives = nest({ 'app.sync.addPage': true }) |
4 | |
5 | exports.needs = nest({ |
6 | 'app.html.tabs': 'first', |
7 | 'app.html.page': 'first' |
8 | }) |
9 | |
10 | exports.create = function (api) { |
11 | return nest({ |
12 | 'app.sync': { |
13 | addPage |
14 | } |
15 | }) |
16 | |
17 | // TODO : make it so error catching doesn't need this, move it into goTo |
18 | function addPage (link, change, split) { |
19 | const tabs = api.app.html.tabs() |
20 | |
21 | const page = api.app.html.page(link) |
22 | if (!page) return |
23 | |
24 | page.id = page.id || link |
25 | tabs.add(page, change, split) |
26 | } |
27 | } |
28 | |
29 | |
30 |
Built with git-ssb-web