Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications: More Generic events #151

Closed
ya7ya opened this issue Sep 12, 2017 · 2 comments
Closed

Notifications: More Generic events #151

ya7ya opened this issue Sep 12, 2017 · 2 comments
Labels
kind/support A question or request for support P3 Low: Not priority right now status/ready Ready to be worked

Comments

@ya7ya
Copy link

ya7ya commented Sep 12, 2017

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?

@ya7ya ya7ya added the kind/support A question or request for support label Sep 12, 2017
@daviddias
Copy link
Member

I'm not against it, my only humble request is that any kind of hooks and/or events to be well documented and why otherwise it is prone to be changed or removed in the future.

@daviddias daviddias added the status/ready Ready to be worked label Sep 13, 2017
@daviddias daviddias added the P2 Medium: Good to have, but can wait until someone steps up label Oct 18, 2017
@jacobheun jacobheun added P3 Low: Not priority right now and removed P2 Medium: Good to have, but can wait until someone steps up labels Jun 18, 2020
@achingbrain
Copy link
Member

I'm closing this because it's been almost three years with no movement here. If you still need this functionality please open a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support A question or request for support P3 Low: Not priority right now status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

4 participants