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

feat: allow removing registered hooks #16

Merged
merged 8 commits into from
Apr 17, 2020
Merged

feat: allow removing registered hooks #16

merged 8 commits into from
Apr 17, 2020

Conversation

matthieusieben
Copy link
Contributor

This will also return a unregister function allowing to write code like this (basically an equivalent of "once"):

const unreg = hable.hook('some:event', () => {
  console.log('do stuff')
  unref()
})

This will also return a `unregister` function allowing to write code like this (basically an equivalent of "once"):
```js
const unreg = hable.hook('some:event', () => {
  console.log('do stuff')
  unref()
})
```
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for PR ❤️

Also would be great if you can help adding tests to cover unregister

src/hable.js Outdated Show resolved Hide resolved
src/hable.js Outdated Show resolved Hide resolved
@Atinux
Copy link
Member

Atinux commented Apr 16, 2020

Thank you @matthieusieben for this PR, after talking with @pi0, it looks good now!

Could you please update the README to reflect the changes this PR brings?

Also, there is a conflict regarding src/hable.js

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thanks!

@pi0 pi0 changed the title Allow removing a registered hook feat: allow removing registered hooks Apr 17, 2020
@pi0 pi0 merged commit 4134c31 into unjs:master Apr 17, 2020
@matthieusieben matthieusieben deleted the patch-1 branch April 17, 2020 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants