Created
June 20, 2017 17:09
-
-
Save creationix/5fea2bad61ab38dcd8852a154457a788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fake hypercore feed for testing and learning | |
var values = [] | |
var feed = { | |
append (value, cb) { | |
console.log('APPEND', {value, cb}) | |
values.push(value) | |
nextTick(cb) | |
}, | |
get (index, options, cb) { | |
console.log('GET', {index, options, cb}) | |
nextTick(cb, null, values[index]) | |
}, | |
get length () { | |
console.log('LENGTH') | |
return values.length | |
}, | |
ready (cb) { | |
console.log('READY', {cb}) | |
nextTick(cb) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment