MCPcopy
hub / github.com/dexie/Dexie.js / changeStatusTo

Function changeStatusTo

addons/Dexie.Syncable/src/connect-protocol.js:37–53  ·  view source on GitHub ↗
(newStatus)

Source from the content-addressed store, hash-verified

35 const url = activePeer.url;
36
37 function changeStatusTo(newStatus) {
38 if (node.status !== newStatus) {
39 node.status = newStatus;
40 node
41 .save()
42 .then(() => {
43 db.syncable.on.statusChanged.fire(newStatus, url);
44 // Also broadcast message to other nodes about the status
45 db.observable.broadcastMessage(
46 'syncStatusChanged',
47 { newStatus: newStatus, url: url },
48 false
49 );
50 })
51 .catch('DatabaseClosedError', () => {});
52 }
53 }
54
55 activePeer.on('disconnect', function (newStatus) {
56 if (!isNaN(newStatus)) changeStatusTo(newStatus);

Callers 6

initConnectProtocolFunction · 0.85
onErrorFunction · 0.85
onChangesFunction · 0.85
reactToChangesFunction · 0.85
onSuccessFunction · 0.85
continueUsingPollPatternFunction · 0.85

Calls 4

catchMethod · 0.65
thenMethod · 0.65
saveMethod · 0.65
fireMethod · 0.65

Tested by

no test coverage detected