Skip to content

Commit

Permalink
docs: update for debounce & interval & time
Browse files Browse the repository at this point in the history
  • Loading branch information
movpushmov committed Apr 23, 2024
1 parent c1ec0e5 commit 51ed264
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/debounce/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ someHappened(4);
### [Tests] Exposed timers API example

```ts
/**
* `canceller` - is object, which contains previous timeout id and previous effect promise reject
*/
const timerFx = createEffect(({ canceller, timeout }: DebounceTimerFxProps) => {
const { timeoutId, rejectPromise } = canceller;

Expand Down
3 changes: 3 additions & 0 deletions src/interval/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ keepFresh(someQuery, {
### [Tests] Exposed timers API example

```ts
/**
* `canceller` - is object, which contains previous timeout id and previous effect promise reject
*/
const timeoutFx = createEffect(({ canceller, timeout, running }: IntervalTimeoutFxProps) => {
if (!running) {
return Promise.reject();
Expand Down
6 changes: 5 additions & 1 deletion src/time/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ tick();
### [Tests] Exposed timers API example

```ts
// you can attach() any source of time
/**
* `timeReader` - is a either `Date.now` or the handler, that was provided via `getNow` in the configuration
*
* In your custom `readNowFx` you can change the way original time reader is used or call your own timer instead
*/
const readNowFx = createEffect<{ timeReader: () => number }, number>(({ timeReader }) => timeReader());

const scope = fork({
Expand Down

0 comments on commit 51ed264

Please sign in to comment.