git ssb

16+

Dominic / patchbay



Tree: 887582819c92e310916bfd0c00d61c9ff27c0baa

Files: 887582819c92e310916bfd0c00d61c9ff27c0baa / modules_basic / message-link.js

674 bytesRaw
1var h = require('hyperscript')
2var 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
8exports.needs = {
9 message_name: 'first'
10}
11
12exports.gives = 'message_link'
13
14exports.create = function (api) {
15
16 return function (id) {
17
18 if('string' !== typeof id)
19 throw new Error('link must be to message id')
20
21 var link = h('a', {href: '#'+id}, id.substring(0, 10)+'...')
22
23 if(ref.isMsg(id))
24 api.message_name(id, function (err, name) {
25 if(err) console.error(err)
26 else link.textContent = name
27 })
28
29 return link
30 }
31}
32
33
34
35
36
37
38
39
40

Built with git-ssb-web