Commit c2b974ef1a490124a6ebec3f593d14d4410d9dad
chronological stream of 10 messages at a time with the help of `pull-next-query` - thanks @mix!
Ev Bogue committed on 6/10/2018, 1:44:08 PMParent: fa68194a664b872178dcd7e28f7505eb33507917
Files changed
package-lock.json | changed |
package.json | changed |
views.js | changed |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 218007 bytes New file size: 219097 bytes |
package.json | ||
---|---|---|
@@ -27,8 +27,9 @@ | ||
27 | 27 … | "non-private-ip": "^1.4.3", |
28 | 28 … | "opn": "^5.3.0", |
29 | 29 … | "os-homedir": "^1.0.2", |
30 | 30 … | "pull-more": "^1.1.0", |
31 … | + "pull-next-query": "^1.0.0", | |
31 | 32 … | "pull-reconnect": "0.0.3", |
32 | 33 … | "pull-stream": "^3.6.8", |
33 | 34 … | "pull-stringify": "^2.0.0", |
34 | 35 … | "rc": "^1.2.7", |
views.js | |||
---|---|---|---|
@@ -6,8 +6,10 @@ | |||
6 | 6 … | var h = require('hyperscript') | |
7 | 7 … | var render = require('./render') | |
8 | 8 … | var ref = require('ssb-ref') | |
9 | 9 … | ||
10 … | +var Next = require('pull-next-query') | ||
11 … | + | ||
10 | 12 … | var config = require('./config')() | |
11 | 13 … | ||
12 | 14 … | var avatar = require('./avatar') | |
13 | 15 … | var id = require('./keys').id | |
@@ -242,56 +244,45 @@ | |||
242 | 244 … | ||
243 | 245 … | screen.appendChild(hyperscroll(content)) | |
244 | 246 … | } | |
245 | 247 … | ||
246 | -var nested = require('libnested') | ||
247 | - | ||
248 | 248 … | function everythingStream () { | |
249 | 249 … | ||
250 | 250 … | var screen = document.getElementById('screen') | |
251 | 251 … | var content = h('div.content') | |
252 | 252 … | ||
253 | 253 … | screen.appendChild(hyperscroll(content)) | |
254 | 254 … | ||
255 | - /*function createStream (opts) { | ||
256 | - return pull( | ||
257 | - More(sbot.query, opts, [{$filter: { value: { timestamp: { $gt: 0 }}}}]), | ||
258 | - pull.map(function (msg) { | ||
259 | - return render(msg) | ||
260 | - }) | ||
261 | - ) | ||
262 | - } | ||
263 | - | ||
264 | - pull( | ||
265 | - createStream({ limit: 10, old: false}), | ||
266 | - stream.top(content) | ||
267 | - ) | ||
268 | - | ||
269 | - pull( | ||
270 | - createStream({limit: 10, live: false, reverse: true}), | ||
271 | - stream.bottom(content) | ||
272 | - )*/ | ||
273 | - | ||
274 | 255 … | function createStream (opts) { | |
275 | 256 … | return pull( | |
276 | - sbot.query({query: [{$filter: { value: { timestamp: { $gt: 0 }}}}], reverse: true}), | ||
257 … | + Next(sbot.query, opts, ['value', 'timestamp']), | ||
277 | 258 … | pull.map(function (msg) { | |
278 | 259 … | if (msg.value) { | |
279 | 260 … | return render(msg) | |
280 | 261 … | } | |
281 | 262 … | }) | |
282 | 263 … | ) | |
283 | 264 … | } | |
284 | 265 … | ||
285 | - /*pull( | ||
286 | - createStream({old: false}), | ||
287 | - stream.top(content) | ||
288 | - )*/ | ||
289 | - | ||
290 | 266 … | pull( | |
291 | - createStream(), | ||
267 … | + createStream({ | ||
268 … | + limit: 10, | ||
269 … | + reverse: true, | ||
270 … | + live: false, | ||
271 … | + query: [{$filter: { value: { timestamp: { $gt: 0 }}}}] | ||
272 … | + }), | ||
292 | 273 … | stream.bottom(content) | |
293 | 274 … | ) | |
275 … | + | ||
276 … | + pull( | ||
277 … | + createStream({ | ||
278 … | + limit: 10, | ||
279 … | + old: false, | ||
280 … | + live: true, | ||
281 … | + query: [{$filter: { value: { timestamp: { $gt: 0 }}}}] | ||
282 … | + }), | ||
283 … | + stream.top(content) | ||
284 … | + ) | ||
294 | 285 … | } | |
295 | 286 … | ||
296 | 287 … | ||
297 | 288 … | function hash () { |
Built with git-ssb-web