git ssb

16+

Dominic / patchbay



Commit 33d49d724c13b515841075e0ae6d096034c78275

backlinks: jump through the api.message_name hoop

Henry committed on 1/11/2017, 12:22:50 AM
Parent: bf289fc707717f3828ed39f6cfcfcc0c51d41947

Files changed

modules_basic/message-backlinks.jschanged
modules_basic/message-backlinks.jsView
@@ -1,7 +1,11 @@
11 const fs = require('fs')
22 const h = require('../h')
33
4 +exports.needs = {
5 + message_name: 'first'
6 +}
7 +
48 exports.gives = {
59 message_backlinks: true,
610 mcss: true
711 }
@@ -26,14 +30,19 @@
2630 }
2731
2832 if (links.length === 0) return null
2933
34 + var hrefList = h('ul')
35 + links.forEach(link => {
36 + api.message_name(link, (err, name) => {
37 + if (err) throw err
38 + hrefList.appendChild(h('li',
39 + h('a -backlink', { href: `#${link}` }, name)
40 + ))
41 + })
42 + })
3043 return h('MessageBacklinks', [
3144 h('header', 'backlinks:'),
32- h('ul', links.map(link => {
33- return h('li', [
34- h('a -backlink', { href: `#${link}` }, link)
35- ])
36- }))
45 + hrefList
3746 ])
3847 }
3948 }

Built with git-ssb-web