Commit 251a4d7b1477eafd58a6093249e659cf49f23e0c
use pull-scroll to get infinite scrolling
Dominic Tarr committed on 5/14/2016, 12:05:10 PMParent: 7cf35de753155a880bece2498dee7cb02c01f251
Files changed
ui.js | changed |
ui.js | ||
---|---|---|
@@ -1,23 +1,15 @@ | ||
1 | 1 | var h = require('hyperscript') |
2 | 2 | var pull = require('pull-stream') |
3 | 3 | var u = require('./util') |
4 | +var Scroller = require('pull-scroll') | |
4 | 5 | |
5 | 6 | exports.createStream = function createStream (stream, render) { |
6 | - var div = h('div.content') | |
7 | + var div = h('div.column', {style: {'overflow-y': 'auto'}}) | |
7 | 8 | |
8 | 9 | pull( |
9 | 10 | 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 | - }) | |
11 | + Scroller(div, div, render, false, false) | |
20 | 12 | ) |
21 | 13 | |
22 | 14 | return div |
23 | 15 | } |
@@ -28,4 +20,5 @@ | ||
28 | 20 | return fn(data, sbot) |
29 | 21 | }) |
30 | 22 | } |
31 | 23 | } |
24 | + |
Built with git-ssb-web