Conversation
README.md
Outdated
|
|
||
| Creates a new block with raw data `data`. `type` can be either `'protobuf'` or `'ipld'`. | ||
|
|
||
| #### `Block.create(data, key, [type, ] callback)` |
There was a problem hiding this comment.
Let's just go ahead and take from #5 the fact that .key becomes a function and make it an async function.
There was a problem hiding this comment.
@diasdavid done, please review the new api before I start propagating
package.json
Outdated
| @@ -38,13 +38,13 @@ | |||
| "homepage": "https://github.com/ipfs/js-ipfs-block#readme", | |||
| "devDependencies": { | |||
| "aegir": "^8.0.0", | |||
|
API looks good, needs:
|
fa9a47f to
41fd06b
Compare
41fd06b to
7941631
Compare
| set () { | ||
| throw new Error('Tried to change an immutable block') | ||
| } | ||
| }) |
src/index.js
Outdated
|
|
||
| multihashing(this.data, hashFunc, callback) | ||
| if (this._cache[hashFunc]) { | ||
| setImmediate(() => { |
There was a problem hiding this comment.
setImmediate isn't supported by FF or Chrome, will it be a problem?
There was a problem hiding this comment.
hmm thanks for pointing this out, need to find a better solution :(
There was a problem hiding this comment.
setImmediate is also used in 4 different places across the codebase. There is also polyfill for it if it comes to it.
There was a problem hiding this comment.
yeah we were shipping one before, but not anymore. As we already use async I'm going to use async.setImmediate http://caolan.github.io/async/docs.html#setImmediate
b9f4187 to
488d68c
Compare
BREAKING CHANGE:
Constructor requires a hash now and there is now Block.create(data, type, cb)