Skip to content

Update Zeroconf class and add methods to remove listeners #13

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

Closed
wants to merge 3 commits into from
Closed

Update Zeroconf class and add methods to remove listeners #13

wants to merge 3 commits into from

Conversation

Rmannn
Copy link

@Rmannn Rmannn commented Aug 2, 2016

The Zeroconf does not have any methods to easily remove listeners of DeviceEventEmitter.

This refractor adds life cycles calls and methods to allow listeners to be cleaned at start and stop (scan() & stop())

New methods:
- removeDeviceListener(string: event)
- removeAllDeviceListeners()

@Rmannn Rmannn closed this Aug 2, 2016
@Rmannn Rmannn reopened this Aug 2, 2016
balthazar added a commit that referenced this pull request Aug 14, 2016
@balthazar
Copy link
Owner

balthazar commented Aug 14, 2016

Hi @Rmannn, thanks for your input and submission! Sorry for the delay.

I've decided not to accept your PR since it changed the initial behavior too much, by not registering listeners at instantiation, but instead in the scan and removing them on each stop.
Besides, you haven't checked if listeners were already set, thus resulting in multiple callbacks for the same event.

My implementation that landed in 0.5.0 allow you to removeDeviceListeners and addDeviceListeners at will. Update of docs will follow.

Do not hesitate if you have any question / remark!

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.

2 participants