Closed
Description
Hey @diasdavid and the IPFS team, I'm building something that requires getting a notification from bitswap._notification
and noticed that it doesn't have more generic events, events are triggered with a string that includes the block.cid
usually. so creating a listener that listens to all block:*
isn't that straightforward.
What if instead of using something like eventemitter2
that adds wildcard and other functionalities , we can just trigger a more generic event like so
// current implementation (notification.js)
hasBlock (block) {
const str = `block:${block.cid.buffer.toString()}`
this._log(str)
this.emit(str, block)
}
// proposed change
hasBlock (block) {
const str = `block:${block.cid.buffer.toString()}`
this._log(str)
this.emit(str, block)
// generic event
this.emit('block', block)
}
What do you think?? Is this something you'd be interested in adding or not?