Ind.ie is now Small Technology Foundation.
Commit 919565fe authored by Aral Balkan's avatar Aral Balkan

Add comment on order of callbacks/etc. for an append

parent 25705775
......@@ -116,10 +116,21 @@ function generateKeys() {
return
}
//
// Note: the order of execution for an append appears to be:
//
// 1. onWrite handler (execution stops unless next() is called)
// 2. feed’s on('append') handler
// 3. feed.append callback function
// 4. readStream’s on('data') handler
//
// Create a read stream
const stream = feed.createReadStream({live:true})
stream.on('data', (data) => {
console.log('Feed [read stream, on data]' , data)
// New data is available on the feed. Display it on the page.
for (let [key, value] of Object.entries(data)) {
hypercoreContentsTextArea.value += `${key}: ${value}\n`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment