Add remove event listener methods

This commit is contained in:
Andras Schmelczer 2025-11-22 20:35:36 +00:00
parent d4b68154df
commit 91675ea99c
6 changed files with 54 additions and 0 deletions

View file

@ -59,6 +59,15 @@ export class Settings {
this.onSettingsChangeHandlers.push(listener);
}
public removeOnSettingsChangeListener(
listener: (settings: SyncSettings, oldSettings: SyncSettings) => unknown
): void {
const index = this.onSettingsChangeHandlers.indexOf(listener);
if (index !== -1) {
this.onSettingsChangeHandlers.splice(index, 1);
}
}
public async setSetting<T extends keyof SyncSettings>(
key: T,
value: SyncSettings[T]