MCPcopy
hub / github.com/mailvelope/mailvelope / sync

Method sync

src/controller/sync.controller.js:205–228  ·  view source on GitHub ↗
(type, data)

Source from the content-addressed store, hash-verified

203 }
204
205 sync(type, data) {
206 return new Promise((resolve, reject) => {
207 const id = getUUID();
208 const timeout = setTimeout(() => {
209 delete this.syncDoneHandler[id];
210 reject(new Error('Sync timeout'));
211 }, this.TIMEOUT * 1000);
212 this.ports.syncHandler.emit('sync-event', {
213 type,
214 data,
215 id
216 });
217 this.syncDoneHandler[id] = (err, data) => {
218 if (timeout) {
219 clearTimeout(timeout);
220 }
221 if (err) {
222 reject(err);
223 } else {
224 resolve(data);
225 }
226 };
227 });
228 }
229
230 syncDone(data) {
231 if (this.syncDoneHandler[data.id]) {

Callers 4

uploadMethod · 0.95
downloadMethod · 0.95
backupMethod · 0.95
restoreMethod · 0.95

Calls 3

getUUIDFunction · 0.90
resolveFunction · 0.85
emitMethod · 0.45

Tested by

no test coverage detected