Files: ae7c2d638a47d2b374cec6c88e45d20c4290fe33 / modules / private.js
1088 bytesRaw
1 | var h = require('hyperscript') |
2 | var ui = require('../ui') |
3 | var u = require('../util') |
4 | var pull = require('pull-stream') |
5 | var Scroller = require('pull-scroll') |
6 | |
7 | function unbox(msg) { |
8 | return u.first(exports.message_unbox, function (fn) { |
9 | return fn(msg) |
10 | }) |
11 | } |
12 | |
13 | exports.screen_view = function (path, sbot) { |
14 | if(path === '/private') { |
15 | |
16 | var content = h('div.column') |
17 | |
18 | var div = h('div.column', {style: {'overflow':'auto'}}, content) |
19 | var render = ui.createRenderers(exports.message_render, sbot) |
20 | |
21 | pull( |
22 | u.next( |
23 | sbot.createLogStream.bind(sbot), |
24 | {reverse: true, limit: 1000} |
25 | //, |
26 | // 'lt', 'timestamp' |
27 | ), |
28 | pull.through(function (e) { |
29 | console.log('msg') |
30 | }), |
31 | pull.filter(function (msg) { |
32 | return 'string' == typeof msg.value.content |
33 | }), |
34 | pull.map(unbox), |
35 | pull.filter(Boolean), |
36 | Scroller(div, content, render, false, false, function (err) { |
37 | if(err) throw err |
38 | }) |
39 | ) |
40 | |
41 | return div |
42 | } |
43 | } |
44 | |
45 | exports.message_render = [] |
46 | exports.message_compose = [] |
47 | exports.message_unbox = [] |
48 | |
49 | |
50 |
Built with git-ssb-web