Skip to content

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

Open
soundprojects wants to merge 3 commits intowatson:masterfrom
soundprojects:master
Open

Allow Bonjour.JS to be used in Electron renderer#36
soundprojects wants to merge 3 commits intowatson:masterfrom
soundprojects:master

Conversation

@soundprojects
Copy link
Copy Markdown

No description provided.

lib/registry.js Outdated
delay = delay * REANNOUNCE_FACTOR
if (delay < REANNOUNCE_MAX_MS && !service._destroyed) {
setTimeout(broadcast, delay).unref()
setTimeout(broadcast, delay).unref && setTimeout(broadcast, delay).unref();
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

Addresses #32

@soundprojects
Copy link
Copy Markdown
Author

Will do!

@dsamarin
Copy link
Copy Markdown

@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