Files: 7ccd9f6868dce175d01ad301ee8dd8ea57e7f912 / index.js
767 bytesRaw
1 | var h = require('hyperscript') |
2 | var pull = require('pull-stream') |
3 | var combine = require('depject') |
4 | var fs = require('fs') |
5 | var path = require('path') |
6 | |
7 | var modules = fs.readdirSync(path.join(__dirname, 'modules')) |
8 | .map(function (e) { return require('./modules/'+e) }) |
9 | |
10 | var renderers = [] |
11 | modules.unshift({message_render: renderers}) |
12 | |
13 | combine(modules) |
14 | |
15 | var u = require('./util') |
16 | |
17 | require('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