Skip to content

Commit

Permalink
Better name for throttle timer too
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrHoroshih committed Sep 12, 2023
1 parent 7cb8fc1 commit 7f96fce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/debounce/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function debounce<T>({
});
});
const timerFx = attach({
name: `debounce(${source.shortName || source.kind}) timer`,
name: `debounce(${source.shortName || source.kind}) effect`,
source: {
timeoutId: $timeoutId,
rejectPromise: $rejecter,
Expand Down
7 changes: 4 additions & 3 deletions src/throttle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ export function throttle<T>({

const $timeout = toStoreNumber(timeout);

const timerFx = createEffect<number, void>(
(timeout) => new Promise((resolve) => setTimeout(resolve, timeout)),
);
const timerFx = createEffect<number, void>({
name: `throttle(${(source as Event<T>).shortName || source.kind}) effect`,
handler: (timeout) => new Promise((resolve) => setTimeout(resolve, timeout)),
});

// It's ok - nothing will ever start unless source is triggered
const $payload = createStore<T>(null as unknown as T, { serialize: 'ignore' }).on(
Expand Down

0 comments on commit 7f96fce

Please sign in to comment.