Skip to content

Commit 16fa61c

Browse files
docs(website): update get started and add throttle
1 parent d50d1f5 commit 16fa61c

File tree

4 files changed

+67
-26
lines changed

4 files changed

+67
-26
lines changed

packages/overmind-website/api/operators.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ This operator allows you to run side effects. You can not change state and you c
100100
h(Example, { name: "api/operators_operator_run" })
101101
```
102102

103+
## throttle
104+
This operator allows you to ensure that if an action is called, the next action will only continue past this point if a certain duration has passed. Typically used when an action is called many times in a short amount of time.
105+
106+
```marksy
107+
h(Example, { name: "api/operators_operator_throttle" })
108+
```
109+
103110
## tryCatch
104111
This operator allows you to scope execution and manage errors. This operator does not return a new value to the execution.
105112

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
export default (ts) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'actions.ts',
6+
code: `
7+
import { Operator, pipe, throttle } from 'overmind'
8+
import * as o from './operators'
9+
10+
export const onMouseDrag: Operator<string> = pipe(
11+
throttle(200),
12+
o.handleMouseDrag()
13+
)
14+
`,
15+
},
16+
]
17+
: [
18+
{
19+
fileName: 'actions.js',
20+
code: `
21+
import { pipe, throttle } from 'overmind'
22+
import * as o from './operators'
23+
24+
export const onMouseDrag = pipe(
25+
throttle(200),
26+
o.handleMouseDrag()
27+
)
28+
`,
29+
},
30+
]

packages/overmind-website/examples/api/operators_operator_waitmutation.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)