Apply suggestions from code review
Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
co-authored by
Alois Klink
parent
01483420c9
commit
fc533d8e11
@@ -165,7 +165,7 @@ export const toggleDarkTheme = (dark: boolean): void => {
|
||||
let urlDebounce: number;
|
||||
export const initURLSubscription = (): void => {
|
||||
stateStore.subscribe(({ serialized }) => {
|
||||
clearInterval(urlDebounce);
|
||||
clearTimeout(urlDebounce);
|
||||
urlDebounce = window.setTimeout(() => {
|
||||
history.replaceState(undefined, undefined, `#${serialized}`);
|
||||
}, 250);
|
||||
|
||||
@@ -53,7 +53,7 @@ const timeouts: Record<string, number> = {};
|
||||
export const logEvent = (name: string, data?: unknown): void => {
|
||||
if (analytics) {
|
||||
const key = data ? JSON.stringify({ name, data }) : name;
|
||||
clearInterval(timeouts[key]);
|
||||
clearTimeout(timeouts[key]);
|
||||
timeouts[key] = window.setTimeout(() => {
|
||||
void analytics.track(name, data);
|
||||
}, 5000);
|
||||
|
||||
Reference in New Issue
Block a user