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

Allow Bonjour.JS to be used in Electron renderer #36

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Allow Bonjour.JS to be used in Electron renderer #36

wants to merge 3 commits into from

Conversation

soundprojects
Copy link

No description provided.

lib/registry.js Outdated
@@ -146,7 +146,7 @@ function announce (server, service) {
}
delay = delay * REANNOUNCE_FACTOR
if (delay < REANNOUNCE_MAX_MS && !service._destroyed) {
setTimeout(broadcast, delay).unref()
setTimeout(broadcast, delay).unref && setTimeout(broadcast, delay).unref();

Choose a reason for hiding this comment

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

This will call the function broadcast twice in Node.

@hackergrrl
Copy link

Nice! Today I learned about unref().

  1. Could you run your PR through standard and fix up the linter warnings?
  2. What do you think about adding a comment noting that your code change is present because Electron's renderer doesn't support unref()?

@hackergrrl
Copy link

Addresses #32

@soundprojects
Copy link
Author

Will do!

@dsamarin
Copy link

@Audiow @noffle It would still be a good thing to clear up resources with unref() even in the renderer process. A better solution would be to access the Node.js timers explicitly with require('timers') as is done in pull request #39

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.

3 participants