Files: c26a377b747816479b1dc93f160726ef84bf6205 / app / sync / initialize / clickHandler.js
502 bytesRaw
1 | const nest = require('depnest') |
2 | |
3 | exports.gives = nest('app.sync.initialize') |
4 | |
5 | exports.needs = nest({ |
6 | 'app.async.catchLinkClick': 'first', |
7 | 'history.sync.push': 'first', |
8 | }) |
9 | |
10 | exports.create = (api) => { |
11 | return nest({ |
12 | 'app.sync.initialize': function initializeClickHandling () { |
13 | const target = document.body |
14 | |
15 | api.app.async.catchLinkClick(target, (link, { isExternal }) => { |
16 | if (isExternal) return openExternal(link) |
17 | |
18 | api.history.sync.push(link) |
19 | }) |
20 | } |
21 | }) |
22 | } |
23 | |
24 |
Built with git-ssb-web