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

Method callback

examples/network/mdns/ntpservice/main.js:49–57  ·  view source on GitHub ↗
(message, value, address, port)

Source from the content-addressed store, hash-verified

47 super({kind: "UDP", port: 123});
48 }
49 callback(message, value, address, port) {
50 if (2 !== message)
51 return;
52
53 const packet = new DataView(new ArrayBuffer(48));
54 packet.setUint8(0, 0x24);
55 packet.setUint32(40, ((Date.now() / 1000) | 0) + 2208988800);
56 this.write(address, port, packet.buffer);
57 }
58}
59
60const timeService = {name: "ntp", protocol: "udp", port: 123, txt: {}};

Callers 1

completeMethod · 0.45

Calls 2

writeMethod · 0.95
setUint8Method · 0.80

Tested by

no test coverage detected