git ssb

16+

Dominic / patchbay



Tree: ed0e128b84b0a1e2a1743a9b9a4f967e6b15ed4b

Files: ed0e128b84b0a1e2a1743a9b9a4f967e6b15ed4b / modules / message-link.js

479 bytesRaw
1var h = require('hyperscript')
2
3var sbot_get = require('../plugs').first(exports.sbot_get = [])
4
5exports.message_link = function (id) {
6
7 if('string' !== typeof id)
8 throw new Error('link must be to message id')
9
10 var link = h('a', {href: '#'+id}, id.substring(0, 10)+'...')
11
12 sbot_get(id, function (err, value) {
13 if(err) return console.error(err)
14 if(value.content.text)
15 link.textContent = value.content.text.substring(0, 40)+'...'
16 })
17
18 return link
19}
20
21
22
23
24
25

Built with git-ssb-web