git ssb

16+

Dominic / patchbay



Tree: 134d423c26820a78c6bbfbc506df577e0673b6b2

Files: 134d423c26820a78c6bbfbc506df577e0673b6b2 / ui.js

649 bytesRaw
1var h = require('hyperscript')
2var pull = require('pull-stream')
3var u = require('./util')
4
5exports.createStream = function createStream (stream, render) {
6 var div = h('div.content')
7
8 pull(
9 stream,
10 pull.drain(function (data) {
11 var el = render(data)
12 if('string' === typeof el) el = document.createTextNode(el)
13 if(el) {
14 if(div.children.length)
15 div.appendChild(h('hr'))
16 div.appendChild(el)
17 }
18
19 })
20 )
21
22 return div
23}
24
25exports.createRenderers = function (renderers, sbot) {
26 return function (data) {
27 return u.first(renderers, function (fn) {
28 return fn(data, sbot)
29 })
30 }
31}
32

Built with git-ssb-web