modules/private.jsView |
---|
3 | 3 | var u = require('../util') |
4 | 4 | var pull = require('pull-stream') |
5 | 5 | var Scroller = require('pull-scroll') |
6 | 6 | |
7 | | -function unbox(msg) { |
8 | | - return u.firstPlug(exports.message_unbox, msg) |
| 7 | +function unbox () { |
| 8 | + return pull( |
| 9 | + pull.filter(function (msg) { |
| 10 | + return 'string' == typeof msg.value.content |
| 11 | + }), |
| 12 | + pull.map(function (msg) { |
| 13 | + return u.firstPlug(exports.message_unbox, msg) |
| 14 | + }), |
| 15 | + pull.filter(Boolean) |
| 16 | + ) |
9 | 17 | } |
10 | 18 | |
11 | 19 | exports.screen_view = function (path, sbot) { |
12 | 20 | if(path === '/private') { |
16 | 24 | var div = h('div.column', {style: {'overflow':'auto'}}, content) |
17 | 25 | var render = ui.createRenderers(exports.message_render, sbot) |
18 | 26 | |
19 | 27 | pull( |
20 | | - u.next( |
21 | | - sbot.createLogStream.bind(sbot), |
22 | | - {reverse: true, limit: 1000} |
23 | | - |
24 | | - |
25 | | - ), |
26 | | - pull.through(function (e) { |
27 | | - console.log('msg') |
28 | | - }), |
29 | | - pull.filter(function (msg) { |
30 | | - return 'string' == typeof msg.value.content |
31 | | - }), |
32 | | - pull.map(unbox), |
33 | | - pull.filter(Boolean), |
| 28 | + sbot.createLogStream({old: false}), |
| 29 | + unbox(), |
| 30 | + Scroller(div, content, render, true, false) |
| 31 | + ) |
| 32 | + |
| 33 | + pull( |
| 34 | + u.next(sbot.createLogStream, {reverse: true, limit: 1000}), |
| 35 | + unbox(), |
34 | 36 | Scroller(div, content, render, false, false, function (err) { |
35 | 37 | if(err) throw err |
36 | 38 | }) |
37 | 39 | ) |
45 | 47 | exports.message_unbox = [] |
46 | 48 | |
47 | 49 | |
48 | 50 | |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | + |