git ssb

16+

Dominic / patchbay



Tree: 7ccd9f6868dce175d01ad301ee8dd8ea57e7f912

Files: 7ccd9f6868dce175d01ad301ee8dd8ea57e7f912 / index.js

767 bytesRaw
1var h = require('hyperscript')
2var pull = require('pull-stream')
3var combine = require('depject')
4var fs = require('fs')
5var path = require('path')
6
7var modules = fs.readdirSync(path.join(__dirname, 'modules'))
8 .map(function (e) { return require('./modules/'+e) })
9
10var renderers = []
11modules.unshift({message_render: renderers})
12
13combine(modules)
14
15var u = require('./util')
16
17require('ssb-client')(function (err, sbot) {
18 if(err) throw err
19 pull(
20 sbot.createLogStream({reverse: true, limit: 100}),
21 pull.drain(function (data) {
22
23 var el = u.first(renderers, function (render) {
24 return render(data, sbot)
25 })
26
27 if('string' === typeof el) el = document.createTextNode(el)
28 if(el) document.body.appendChild(el)
29 })
30 )
31})
32
33
34
35
36
37
38

Built with git-ssb-web