Commit 4c19550a991fe099117a720ba1ac9e2b7db1fc6e
live queries for edits
Ev Bogue committed on 5/28/2018, 1:28:08 AMParent: b0af4a5b196f6a3c00d7b9e44537ccdf1248230e
Files changed
render.js | changed |
render.js | ||
---|---|---|
@@ -34,20 +34,25 @@ | ||
34 | 34 | message.appendChild(h('div.message__body', tools.markdown(msg.value.content.text))) |
35 | 35 | |
36 | 36 | |
37 | 37 | 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}), | |
39 | 39 | 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 | + }) | |
50 | 55 | ) |
51 | 56 | |
52 | 57 | var buttons = h('div.buttons') |
53 | 58 | buttons.appendChild(h('button.btn', 'Reply', { |
Built with git-ssb-web