Files: 728c0ce9d46f93e3a253ac9117807be3cd9e4d96 / app / sync / addPage.js
542 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': { addPage } |
13 | }) |
14 | |
15 | // TODO : make it so error catching doesn't need this, move it into goTo |
16 | function addPage (link, change, split) { |
17 | const tabs = api.app.html.tabs() |
18 | |
19 | const page = api.app.html.page(link) |
20 | if (!page) return |
21 | |
22 | page.id = page.id || link |
23 | tabs.add(page, change, split) |
24 | } |
25 | } |
26 | |
27 |
Built with git-ssb-web