Commit f960c112edc6322f0a27acb2c329784070fff94c
add channel.html.link
Matt McKegg committed on 12/15/2017, 5:37:03 AMParent: e7d5cdbdb346814e2e65133e1b9720cb4c1638e0
Files changed
channel/html/link.js | added |
channel/html/link.js | ||
---|---|---|
@@ -1,0 +1,15 @@ | ||
1 … | +var h = require('mutant/h') | |
2 … | +var nest = require('depnest') | |
3 … | + | |
4 … | +exports.needs = nest({ | |
5 … | + 'channel.sync.normalize': 'first' | |
6 … | +}) | |
7 … | + | |
8 … | +exports.gives = nest('channel.html.link') | |
9 … | + | |
10 … | +exports.create = function (api) { | |
11 … | + return nest('channel.html.link', function (channel, text = null) { | |
12 … | + var ref = `#${api.channel.sync.normalize(channel)}` | |
13 … | + return h('a ChannelLink', {href: ref, title: ref}, text || ref) | |
14 … | + }) | |
15 … | +} |
Built with git-ssb-web