diff --git a/docs/api/cozy-pouch-link/classes/PouchLink.md b/docs/api/cozy-pouch-link/classes/PouchLink.md index 21a9f8c09..ff46af62e 100644 --- a/docs/api/cozy-pouch-link/classes/PouchLink.md +++ b/docs/api/cozy-pouch-link/classes/PouchLink.md @@ -32,7 +32,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:89](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L89) +[CozyPouchLink.js:95](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L95) ## Properties @@ -42,7 +42,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:149](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L149) +[CozyPouchLink.js:166](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L166) *** @@ -52,7 +52,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:104](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L104) +[CozyPouchLink.js:112](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L112) *** @@ -62,7 +62,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:105](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L105) +[CozyPouchLink.js:113](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L113) *** @@ -72,7 +72,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:106](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L106) +[CozyPouchLink.js:114](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L114) *** @@ -82,7 +82,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:110](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L110) +[CozyPouchLink.js:118](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L118) *** @@ -92,7 +92,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:98](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L98) +[CozyPouchLink.js:106](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L106) *** @@ -102,7 +102,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:111](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L111) +[CozyPouchLink.js:119](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L119) *** @@ -112,7 +112,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:219](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L219) +[CozyPouchLink.js:236](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L236) *** @@ -122,7 +122,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:114](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L114) +[CozyPouchLink.js:122](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L122) *** @@ -132,7 +132,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:107](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L107) +[CozyPouchLink.js:115](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L115) ## Methods @@ -152,7 +152,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:746](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L746) +[CozyPouchLink.js:789](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L789) *** @@ -172,7 +172,7 @@ CozyLink.constructor *Defined in* -[CozyPouchLink.js:707](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L707) +[CozyPouchLink.js:750](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L750) *** @@ -198,7 +198,7 @@ Create the PouchDB index if not existing *Defined in* -[CozyPouchLink.js:538](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L538) +[CozyPouchLink.js:581](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L581) *** @@ -219,7 +219,7 @@ Create the PouchDB index if not existing *Defined in* -[CozyPouchLink.js:750](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L750) +[CozyPouchLink.js:793](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L793) *** @@ -239,7 +239,7 @@ Create the PouchDB index if not existing *Defined in* -[CozyPouchLink.js:735](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L735) +[CozyPouchLink.js:778](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L778) *** @@ -261,7 +261,7 @@ Create the PouchDB index if not existing *Defined in* -[CozyPouchLink.js:677](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L677) +[CozyPouchLink.js:720](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L720) *** @@ -281,7 +281,7 @@ Create the PouchDB index if not existing *Defined in* -[CozyPouchLink.js:615](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L615) +[CozyPouchLink.js:658](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L658) *** @@ -305,7 +305,7 @@ Retrieve the PouchDB index if exist, undefined otherwise *Defined in* -[CozyPouchLink.js:562](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L562) +[CozyPouchLink.js:605](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L605) *** @@ -331,7 +331,7 @@ The changes *Defined in* -[CozyPouchLink.js:415](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L415) +[CozyPouchLink.js:458](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L458) *** @@ -356,7 +356,7 @@ The db info *Defined in* -[CozyPouchLink.js:430](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L430) +[CozyPouchLink.js:473](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L473) *** @@ -376,7 +376,7 @@ The db info *Defined in* -[CozyPouchLink.js:340](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L340) +[CozyPouchLink.js:383](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L383) *** @@ -396,7 +396,7 @@ The db info *Defined in* -[CozyPouchLink.js:129](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L129) +[CozyPouchLink.js:146](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L146) *** @@ -416,7 +416,7 @@ The db info *Defined in* -[CozyPouchLink.js:336](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L336) +[CozyPouchLink.js:379](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L379) *** @@ -436,7 +436,7 @@ The db info *Defined in* -[CozyPouchLink.js:273](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L273) +[CozyPouchLink.js:290](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L290) *** @@ -456,7 +456,7 @@ The db info *Defined in* -[CozyPouchLink.js:268](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L268) +[CozyPouchLink.js:285](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L285) *** @@ -482,7 +482,7 @@ Emits an event (pouchlink:sync:end) when the sync (all doctypes) is done *Defined in* -[CozyPouchLink.js:254](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L254) +[CozyPouchLink.js:271](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L271) *** @@ -502,7 +502,7 @@ Emits an event (pouchlink:sync:end) when the sync (all doctypes) is done *Defined in* -[CozyPouchLink.js:524](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L524) +[CozyPouchLink.js:567](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L567) *** @@ -532,7 +532,7 @@ Migrate the current adapter *Defined in* -[CozyPouchLink.js:163](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L163) +[CozyPouchLink.js:180](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L180) *** @@ -557,7 +557,7 @@ the need to wait for the warmup *Defined in* -[CozyPouchLink.js:510](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L510) +[CozyPouchLink.js:553](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L553) *** @@ -571,7 +571,7 @@ the need to wait for the warmup *Defined in* -[CozyPouchLink.js:182](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L182) +[CozyPouchLink.js:199](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L199) *** @@ -591,7 +591,7 @@ the need to wait for the warmup *Defined in* -[CozyPouchLink.js:316](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L316) +[CozyPouchLink.js:359](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L359) *** @@ -616,7 +616,7 @@ CozyLink.persistCozyData *Defined in* -[CozyPouchLink.js:465](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L465) +[CozyPouchLink.js:508](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L508) *** @@ -636,7 +636,7 @@ CozyLink.persistCozyData *Defined in* -[CozyPouchLink.js:148](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L148) +[CozyPouchLink.js:165](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L165) *** @@ -662,7 +662,7 @@ CozyLink.request *Defined in* -[CozyPouchLink.js:359](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L359) +[CozyPouchLink.js:402](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L402) *** @@ -680,7 +680,7 @@ CozyLink.reset *Defined in* -[CozyPouchLink.js:238](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L238) +[CozyPouchLink.js:255](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L255) *** @@ -700,7 +700,7 @@ CozyLink.reset *Defined in* -[CozyPouchLink.js:438](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L438) +[CozyPouchLink.js:481](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L481) *** @@ -719,7 +719,25 @@ Emits pouchlink:sync:start event when the replication begins *Defined in* -[CozyPouchLink.js:287](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L287) +[CozyPouchLink.js:319](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L319) + +*** + +### startReplicationWithDebounce + +▸ **startReplicationWithDebounce**(): `void` + +Debounced version of startReplication() method + +Debounce delay can be configured through constructor's `syncDebounceDelayInMs` option + +*Returns* + +`void` + +*Defined in* + +[CozyPouchLink.js:332](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L332) *** @@ -738,7 +756,7 @@ Emits pouchlink:sync:stop event *Defined in* -[CozyPouchLink.js:308](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L308) +[CozyPouchLink.js:351](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L351) *** @@ -758,7 +776,7 @@ Emits pouchlink:sync:stop event *Defined in* -[CozyPouchLink.js:344](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L344) +[CozyPouchLink.js:387](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L387) *** @@ -772,7 +790,7 @@ Emits pouchlink:sync:stop event *Defined in* -[CozyPouchLink.js:772](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L772) +[CozyPouchLink.js:815](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L815) *** @@ -792,7 +810,7 @@ Emits pouchlink:sync:stop event *Defined in* -[CozyPouchLink.js:712](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L712) +[CozyPouchLink.js:755](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L755) *** @@ -812,7 +830,7 @@ Emits pouchlink:sync:stop event *Defined in* -[CozyPouchLink.js:717](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L717) +[CozyPouchLink.js:760](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L760) *** @@ -837,4 +855,4 @@ The adapter name *Defined in* -[CozyPouchLink.js:124](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L124) +[CozyPouchLink.js:141](https://github.com/cozy/cozy-client/blob/master/packages/cozy-pouch-link/src/CozyPouchLink.js#L141) diff --git a/packages/cozy-pouch-link/src/CozyPouchLink.js b/packages/cozy-pouch-link/src/CozyPouchLink.js index 3685ce731..f416dd49e 100644 --- a/packages/cozy-pouch-link/src/CozyPouchLink.js +++ b/packages/cozy-pouch-link/src/CozyPouchLink.js @@ -11,6 +11,7 @@ import defaults from 'lodash/defaults' import mapValues from 'lodash/mapValues' import zipWith from 'lodash/zipWith' import get from 'lodash/get' +import debounce from 'lodash/debounce' import { default as helpers } from './helpers' import { getIndexNameFromFields, getIndexFields } from './mango' @@ -37,6 +38,9 @@ const DEFAULT_OPTIONS = { replicationInterval: 30 * 1000 } +const DEFAULT_DEBOUNCE_DELAY = 10 * 1000 +const MAX_DEBOUNCE_DELAY = 600 * 1000 + const addBasicAuth = (url, basicAuth) => { return url.replace('//', `//${basicAuth}`) } @@ -68,6 +72,8 @@ const normalizeAll = client => (docs, doctype) => { * @typedef {object} PouchLinkOptions * @property {boolean} initialSync Whether or not a replication process should be started. Default is false * @property {boolean} periodicSync Whether or not the replication should be periodic. Default is true + * @property {number} [syncDebounceDelayInMs] Debounce delay (in ms) when calling `startReplicationWithDebounce()` method. Should be used only when periodicSync is false. Default is 10 seconds + * @property {number} [syncDebounceMaxDelayInMs] The maximum duration (in ms) the `startReplicationWithDebounce()` method can be delayed. Should be used only when periodicSync is false. Default is 10 minutes * @property {number} [replicationInterval] Milliseconds between periodic replications * @property {string[]} doctypes Doctypes to replicate * @property {Record} doctypesReplicationOptions A mapping from doctypes to replication options. All pouch replication options can be used, as well as the "strategy" option that determines which way the replication is done (can be "sync", "fromRemote" or "toRemote") @@ -93,7 +99,9 @@ class PouchLink extends CozyLink { doctypes, doctypesReplicationOptions, periodicSync, - initialSync + initialSync, + syncDebounceDelayInMs, + syncDebounceMaxDelayInMs } = options this.options = options if (!doctypes) { @@ -112,6 +120,15 @@ class PouchLink extends CozyLink { /** @type {Record} - Stores replication states per doctype */ this.replicationStatus = this.replicationStatus || {} + + /** @private */ + this.startReplicationDebounced = debounce( + this._startReplication, + syncDebounceDelayInMs || DEFAULT_DEBOUNCE_DELAY, + { + maxWait: syncDebounceMaxDelayInMs || MAX_DEBOUNCE_DELAY + } + ) } /** @@ -275,6 +292,21 @@ class PouchLink extends CozyLink { this.client.emit('pouchlink:doctypesync:end', doctype) } + /** + * @private + */ + _startReplication() { + this.client.emit('pouchlink:sync:start') + if (this.periodicSync) { + this.pouches.startReplicationLoop() + } else { + this.pouches.replicateOnce() + } + if (this.options.onStartReplication) { + this.options.onStartReplication.apply(this) + } + } + /** * User of the link can call this to start ongoing replications. * Typically, it can be used when the application regains focus. @@ -285,15 +317,26 @@ class PouchLink extends CozyLink { * @returns {void} */ startReplication() { - this.client.emit('pouchlink:sync:start') + this.startReplicationDebounced.cancel() + return this._startReplication() + } + + /** + * Debounced version of startReplication() method + * + * Debounce delay can be configured through constructor's `syncDebounceDelayInMs` option + * + * @public + * @returns {void} + */ + startReplicationWithDebounce() { if (this.periodicSync) { - this.pouches.startReplicationLoop() - } else { - this.pouches.replicateOnce() - } - if (this.options.onStartReplication) { - this.options.onStartReplication.apply(this) + throw new Error( + 'createDebounceableReplication cannot be called when periodic sync is configured' + ) } + + return this.startReplicationDebounced() } /** diff --git a/packages/cozy-pouch-link/types/CozyPouchLink.d.ts b/packages/cozy-pouch-link/types/CozyPouchLink.d.ts index ea909ee96..afcc03899 100644 --- a/packages/cozy-pouch-link/types/CozyPouchLink.d.ts +++ b/packages/cozy-pouch-link/types/CozyPouchLink.d.ts @@ -12,6 +12,14 @@ export type PouchLinkOptions = { * Whether or not the replication should be periodic. Default is true */ periodicSync: boolean; + /** + * Debounce delay (in ms) when calling `startReplicationWithDebounce()` method. Should be used only when periodicSync is false. Default is 10 seconds + */ + syncDebounceDelayInMs?: number; + /** + * The maximum duration (in ms) the `startReplicationWithDebounce()` method can be delayed. Should be used only when periodicSync is false. Default is 10 minutes + */ + syncDebounceMaxDelayInMs?: number; /** * Milliseconds between periodic replications */ @@ -38,6 +46,8 @@ export type PouchLinkOptions = { * @typedef {object} PouchLinkOptions * @property {boolean} initialSync Whether or not a replication process should be started. Default is false * @property {boolean} periodicSync Whether or not the replication should be periodic. Default is true + * @property {number} [syncDebounceDelayInMs] Debounce delay (in ms) when calling `startReplicationWithDebounce()` method. Should be used only when periodicSync is false. Default is 10 seconds + * @property {number} [syncDebounceMaxDelayInMs] The maximum duration (in ms) the `startReplicationWithDebounce()` method can be delayed. Should be used only when periodicSync is false. Default is 10 minutes * @property {number} [replicationInterval] Milliseconds between periodic replications * @property {string[]} doctypes Doctypes to replicate * @property {Record} doctypesReplicationOptions A mapping from doctypes to replication options. All pouch replication options can be used, as well as the "strategy" option that determines which way the replication is done (can be "sync", "fromRemote" or "toRemote") @@ -74,6 +84,8 @@ declare class PouchLink extends CozyLink { periodicSync: boolean; /** @type {Record} - Stores replication states per doctype */ replicationStatus: Record; + /** @private */ + private startReplicationDebounced; getReplicationURL(doctype: any): string; registerClient(client: any): Promise; client: any; @@ -118,6 +130,10 @@ declare class PouchLink extends CozyLink { handleOnSync(doctypeUpdates: any): void; handleDoctypeSyncStart(doctype: any): void; handleDoctypeSyncEnd(doctype: any): void; + /** + * @private + */ + private _startReplication; /** * User of the link can call this to start ongoing replications. * Typically, it can be used when the application regains focus. @@ -128,6 +144,15 @@ declare class PouchLink extends CozyLink { * @returns {void} */ public startReplication(): void; + /** + * Debounced version of startReplication() method + * + * Debounce delay can be configured through constructor's `syncDebounceDelayInMs` option + * + * @public + * @returns {void} + */ + public startReplicationWithDebounce(): void; /** * User of the link can call this to stop ongoing replications. * Typically, it can be used when the applications loses focus.