- commit
- 7ed8b3c
- parent
- b143e9f
- author
- Eric Bower
- date
- 2024-02-23 20:57:47 +0000 UTC
docs: clearTimers
1 files changed,
+15,
-0
+15,
-0
1@@ -149,3 +149,18 @@ store.dispatch(fetchUsers());
2
3 The default value provided to `timer()` is **5 minutes**. This means you can
4 only call `fetchUsers` at-most once every **5 minutes**.
5+
6+## clearTimers
7+
8+Want to clear a timer and refetch?
9+
10+```ts
11+import { clearTimers, timer } from "starfx";
12+
13+const fetchUsers = api.get("/users", { supervisor: timer(1000) });
14+store.dispatch(fetchUsers());
15+store.dispatch(clearTimers(fetchUsers()));
16+store.dispatch(fetchUsers());
17+// called: 2 times
18+store.dispatch(clearTimers("*")); // clear all timers
19+```