Apply suggestions from code review
Co-authored-by: Simon Knott <info@simonknott.de> Signed-off-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
parent
3bdf1d458f
commit
05f11f7da3
|
|
@ -38,7 +38,7 @@ declare global {
|
||||||
playwrightSetSelector: (selector: string, focus?: boolean) => void;
|
playwrightSetSelector: (selector: string, focus?: boolean) => void;
|
||||||
playwrightUpdateLogs: (callLogs: CallLog[]) => void;
|
playwrightUpdateLogs: (callLogs: CallLog[]) => void;
|
||||||
dispatch(data: EventData): Promise<void>;
|
dispatch(data: EventData): Promise<void>;
|
||||||
saveSettings(): Promise<void>;
|
saveSettings?(): Promise<void>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ export function useSetting<S>(name: string | undefined, defaultValue: S, title?:
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
saveSettings(): Promise<void>;
|
saveSettings?(): Promise<void>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,8 +181,7 @@ export class Settings {
|
||||||
setString(name: string, value: string) {
|
setString(name: string, value: string) {
|
||||||
localStorage[name] = value;
|
localStorage[name] = value;
|
||||||
this.onChangeEmitter.dispatchEvent(new Event(name));
|
this.onChangeEmitter.dispatchEvent(new Event(name));
|
||||||
if (window.saveSettings)
|
window.saveSettings?.();
|
||||||
window.saveSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getObject<T>(name: string, defaultValue: T): T {
|
getObject<T>(name: string, defaultValue: T): T {
|
||||||
|
|
@ -198,9 +197,7 @@ export class Settings {
|
||||||
setObject<T>(name: string, value: T) {
|
setObject<T>(name: string, value: T) {
|
||||||
localStorage[name] = JSON.stringify(value);
|
localStorage[name] = JSON.stringify(value);
|
||||||
this.onChangeEmitter.dispatchEvent(new Event(name));
|
this.onChangeEmitter.dispatchEvent(new Event(name));
|
||||||
|
window.saveSettings?.();
|
||||||
if (window.saveSettings)
|
|
||||||
window.saveSettings();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue