Skip to content

Commit

Permalink
docs: clearTimers
Browse files Browse the repository at this point in the history
  • Loading branch information
neurosnap committed Feb 23, 2024
1 parent b143e9f commit 7ed8b3c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/posts/supervisors.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,18 @@ store.dispatch(fetchUsers());

The default value provided to `timer()` is **5 minutes**. This means you can
only call `fetchUsers` at-most once every **5 minutes**.

## clearTimers

Want to clear a timer and refetch?

```ts
import { clearTimers, timer } from "starfx";

const fetchUsers = api.get("/users", { supervisor: timer(1000) });
store.dispatch(fetchUsers());
store.dispatch(clearTimers(fetchUsers()));
store.dispatch(fetchUsers());
// called: 2 times
store.dispatch(clearTimers("*")); // clear all timers
```

0 comments on commit 7ed8b3c

Please sign in to comment.