Files: 33dbf75c73b0fb716af94766e08f4dd2fd3443d5 / modules / message-link.js
547 bytesRaw
1 | var h = require('hyperscript') |
2 | var ref = require('ssb-ref') |
3 | |
4 | var first = require('../plugs').first |
5 | var sbot_get = first(exports.sbot_get = []) |
6 | var message_name = first(exports.message_name = []) |
7 | |
8 | exports.message_link = function (id) { |
9 | |
10 | if('string' !== typeof id) |
11 | throw new Error('link must be to message id') |
12 | |
13 | var link = h('a', {href: '#'+id}, id.substring(0, 10)+'...') |
14 | |
15 | if(ref.isMsg(id)) |
16 | message_name(id, function (err, name) { |
17 | if(err) console.error(err) |
18 | else link.textContent = name |
19 | }) |
20 | |
21 | return link |
22 | } |
23 | |
24 | |
25 | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 | |
32 | |
33 | |
34 |
Built with git-ssb-web