git ssb

2+

ev / mvd



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 PM
Parent: fa68194a664b872178dcd7e28f7505eb33507917

Files changed

package-lock.jsonchanged
package.jsonchanged
views.jschanged
package-lock.jsonView
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.jsonView
@@ -27,8 +27,9 @@
2727 "non-private-ip": "^1.4.3",
2828 "opn": "^5.3.0",
2929 "os-homedir": "^1.0.2",
3030 "pull-more": "^1.1.0",
31 + "pull-next-query": "^1.0.0",
3132 "pull-reconnect": "0.0.3",
3233 "pull-stream": "^3.6.8",
3334 "pull-stringify": "^2.0.0",
3435 "rc": "^1.2.7",
views.jsView
@@ -6,8 +6,10 @@
66 var h = require('hyperscript')
77 var render = require('./render')
88 var ref = require('ssb-ref')
99
10 +var Next = require('pull-next-query')
11 +
1012 var config = require('./config')()
1113
1214 var avatar = require('./avatar')
1315 var id = require('./keys').id
@@ -242,56 +244,45 @@
242244
243245 screen.appendChild(hyperscroll(content))
244246 }
245247
246-var nested = require('libnested')
247-
248248 function everythingStream () {
249249
250250 var screen = document.getElementById('screen')
251251 var content = h('div.content')
252252
253253 screen.appendChild(hyperscroll(content))
254254
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-
274255 function createStream (opts) {
275256 return pull(
276- sbot.query({query: [{$filter: { value: { timestamp: { $gt: 0 }}}}], reverse: true}),
257 + Next(sbot.query, opts, ['value', 'timestamp']),
277258 pull.map(function (msg) {
278259 if (msg.value) {
279260 return render(msg)
280261 }
281262 })
282263 )
283264 }
284265
285- /*pull(
286- createStream({old: false}),
287- stream.top(content)
288- )*/
289-
290266 pull(
291- createStream(),
267 + createStream({
268 + limit: 10,
269 + reverse: true,
270 + live: false,
271 + query: [{$filter: { value: { timestamp: { $gt: 0 }}}}]
272 + }),
292273 stream.bottom(content)
293274 )
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 + )
294285 }
295286
296287
297288 function hash () {

Built with git-ssb-web