MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / update

Method update

modules/io/dnssd/dnssd.js:127–147  ·  view source on GitHub ↗
(service)

Source from the content-addressed store, hash-verified

125 service.timer.interval = 500;
126 }
127 update(service) {
128 const index = this.services.indexOf(service);
129 if (index < 0) throw new Error("service not found");
130
131 if (!service.updater) {
132 service.updater = Timer.set(updater => {
133 this.write(this.reply(null, 0x04 | 0x8000, service));
134 updater.interval += 250;
135 if (updater.interval >= 1500) {
136 Timer.clear(updater);
137 delete service.updater;
138 delete service.update;
139 }
140 else
141 Timer.schedule(updater, updater.interval, 250);
142 }, 0, 250);
143 }
144 else
145 Timer.schedule(service.updater, 0, 250);
146 service.updater.interval = 0;
147 }
148 remove(service, callback) {
149 if ("string" === typeof service) {
150 service += ".local";

Callers 1

updateTXTMethod · 0.45

Calls 5

writeMethod · 0.95
replyMethod · 0.95
scheduleMethod · 0.80
setMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected