git ssb

1+

punkmonk.termux / mvd



forked from ev / mvd

Commit 4c19550a991fe099117a720ba1ac9e2b7db1fc6e

live queries for edits

Ev Bogue committed on 5/28/2018, 1:28:08 AM
Parent: b0af4a5b196f6a3c00d7b9e44537ccdf1248230e

Files changed

render.jschanged
render.jsView
@@ -34,20 +34,25 @@
3434 message.appendChild(h('div.message__body', tools.markdown(msg.value.content.text)))
3535
3636
3737 pull(
38- sbot.query({query: [{$filter: {value: {content: {type: 'edit', original: msg.key}}}}]}),
38+ sbot.query({query: [{$filter: {value: {content: {type: 'edit', original: msg.key}}}}], limit: 100, live: true}),
3939 pull.drain(function (update) {
40- var newMessage = h('div', tools.markdown(update.value.content.text))
41- var latest = h('div.message__body',
42- tools.timestamp(update, {edited: true}),
43- newMessage
44- )
45- message.replaceChild(latest, message.childNodes[message.childNodes.length - 2])
46- fallback.messageText = update.value.content.text
47- opts.updated = update.key
48- opts.original = msg.key
49- })
40+ console.log(update)
41+ if (update.sync) {
42+ console.log('Waiting for new edits.')
43+ } else {
44+ var newMessage = h('div', tools.markdown(update.value.content.text))
45+ var latest = h('div.message__body',
46+ tools.timestamp(update, {edited: true}),
47+ newMessage
48+ )
49+ message.replaceChild(latest, message.childNodes[message.childNodes.length - 2])
50+ fallback.messageText = update.value.content.text
51+ opts.updated = update.key
52+ opts.original = msg.key
53+ }
54+ })
5055 )
5156
5257 var buttons = h('div.buttons')
5358 buttons.appendChild(h('button.btn', 'Reply', {

Built with git-ssb-web