Add comments

This commit is contained in:
Andras Schmelczer 2025-02-23 14:13:40 +00:00
parent c5a89f5205
commit 36633dfbcb
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C

View file

@ -67,6 +67,7 @@ export class SyncClient {
settings: undefined, settings: undefined,
database: undefined database: undefined
}; };
const database = new Database( const database = new Database(
logger, logger,
state.database, state.database,
@ -136,6 +137,9 @@ export class SyncClient {
return this._syncService.checkConnection(); return this._syncService.checkConnection();
} }
/// Wait for the in-flight operations to finish, reset all tracking,
/// and the local database but retain the settings.
/// The SyncClient can be used again after calling this method.
public async reset(): Promise<void> { public async reset(): Promise<void> {
await this._syncer.reset(); await this._syncer.reset();
this._history.reset(); this._history.reset();
@ -143,6 +147,7 @@ export class SyncClient {
this.logger.reset(); this.logger.reset();
} }
/// Clear all global state that has been touched by SyncClient.
public stop(): void { public stop(): void {
if (this.remoteListenerIntervalId !== null) { if (this.remoteListenerIntervalId !== null) {
clearInterval(this.remoteListenerIntervalId); clearInterval(this.remoteListenerIntervalId);