bonjour-hap
Advanced tools
Comparing version 3.6.5 to 3.7.0
@@ -85,4 +85,7 @@ 'use strict' | ||
matches.forEach(function (service) { | ||
if (self._serviceMap[service.fqdn]) return // ignore already registered services | ||
self._addService(service) | ||
if (self._serviceMap[service.fqdn]) { | ||
self._updateService(service) | ||
} else { | ||
self._addService(service) | ||
} | ||
}) | ||
@@ -113,2 +116,17 @@ }) | ||
Browser.prototype._updateService = function (service) { | ||
let cachedService, index | ||
this.services.some(function (s, i) { | ||
if (dnsEqual(s.fqdn, service.fqdn)) { | ||
cachedService = s | ||
index = i | ||
return true | ||
} | ||
return false | ||
}) | ||
if (!cachedService) return | ||
this.services[index] = service | ||
this.emit('update', service) | ||
} | ||
Browser.prototype._removeService = function (fqdn) { | ||
@@ -115,0 +133,0 @@ let service, index |
{ | ||
"name": "bonjour-hap", | ||
"version": "3.6.5", | ||
"version": "3.7.0", | ||
"description": "A Bonjour/Zeroconf implementation in pure JavaScript (for HAP)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -115,2 +115,6 @@ # bonjour-hap | ||
#### `Event: update` | ||
Emitted every time an update is received for existing service is found that matches the browser. | ||
#### `Event: down` | ||
@@ -140,3 +144,3 @@ | ||
Emitted when the service is up. | ||
Emitted when the service is up, and if the txt record of the service is updated `service.updateTxt(object)`. | ||
@@ -143,0 +147,0 @@ #### `Event: error` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32173
742
204