git ssb

16+

Dominic / patchbay



Commit 7b8459c024b593664fa22d32c9b9bcccfe02a2fa

scroll stream at both ends (live at top, old at bottom)

Dominic Tarr committed on 5/20/2016, 9:09:40 AM
Parent: ceab09c9e34bbabf034b57309315733a28ec5e7a

Files changed

modules/main.jschanged
modules/private.jschanged
modules/main.jsView
@@ -15,9 +15,14 @@
1515 )
1616 var render = ui.createRenderers(exports.message_render, sbot)
1717
1818 pull(
19- u.next(sbot.createLogStream, {reverse: true, limit: 100}),
19+ sbot.createLogStream({old: false}),
20+ Scroller(div, content, render, true, false)
21+ )
22+
23+ pull(
24+ u.next(sbot.createLogStream, {reverse: true, limit: 100, live: false}),
2025 Scroller(div, content, render, false, false)
2126 )
2227
2328 return div
@@ -30,4 +35,6 @@
3035
3136
3237
3338
39+
40+
modules/private.jsView
@@ -3,10 +3,18 @@
33 var u = require('../util')
44 var pull = require('pull-stream')
55 var Scroller = require('pull-scroll')
66
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+ )
917 }
1018
1119 exports.screen_view = function (path, sbot) {
1220 if(path === '/private') {
@@ -16,22 +24,16 @@
1624 var div = h('div.column', {style: {'overflow':'auto'}}, content)
1725 var render = ui.createRenderers(exports.message_render, sbot)
1826
1927 pull(
20- u.next(
21- sbot.createLogStream.bind(sbot),
22- {reverse: true, limit: 1000}
23-//,
24-// 'lt', 'timestamp'
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(),
3436 Scroller(div, content, render, false, false, function (err) {
3537 if(err) throw err
3638 })
3739 )
@@ -45,4 +47,13 @@
4547 exports.message_unbox = []
4648
4749
4850
51+
52+
53+
54+
55+
56+
57+
58+
59+

Built with git-ssb-web