Open History to see the last commit
1---
2id: DebouncerOptions
3title: DebouncerOptions
4---
5
6Defined in: [debouncer.ts:49](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/debouncer.ts#L49)
7
8Options for configuring a debounced function
9
10## Type Parameters
11
12### TFn
13
14`TFn` *extends* [`AnyFunction`](../type-aliases/AnyFunction.md)
15
16## Properties
17
18### enabled?
19
20```ts
21optional enabled?: boolean | ((debouncer) => boolean);
22```
23
24Defined in: [debouncer.ts:55](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/debouncer.ts#L55)
25
26Whether the debouncer is enabled. When disabled, maybeExecute will not trigger any executions.
27Can be a boolean or a function that returns a boolean.
28Defaults to true.
29
30***
31
32### initialState?
33
34```ts
35optional initialState?: Partial<DebouncerState<TFn>>;
36```
37
38Defined in: [debouncer.ts:59](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/debouncer.ts#L59)
39
40Initial state for the debouncer
41
42***
43
44### key?
45
46```ts
47optional key?: string;
48```
49
50Defined in: [debouncer.ts:64](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/debouncer.ts#L64)
51
52A key to identify the debouncer.
53If provided, the debouncer will be identified by this key in the devtools and PacerProvider if applicable.
54
55***
56
57### leading?
58
59```ts
60optional leading?: boolean;
61```
62
63Defined in: [debouncer.ts:70](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/debouncer.ts#L70)
64
65Whether to execute on the leading edge of the timeout.
66The first call will execute immediately and the rest will wait the delay.
67Defaults to false.
68
69***
70
71### onExecute?
72
73```ts
74optional onExecute?: (args, debouncer) => void;
75```
76
77Defined in: [debouncer.ts:74](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/debouncer.ts#L74)
78
79Callback function that is called after the function is executed
80
81#### Parameters
82
83##### args
84
85`Parameters`\<`TFn`\>
86
87##### debouncer
88
89[`Debouncer`](../classes/Debouncer.md)\<`TFn`\>
90
91#### Returns
92
93`void`
94
95***
96
97### trailing?
98
99```ts
100optional trailing?: boolean;
101```
102
103Defined in: [debouncer.ts:79](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/debouncer.ts#L79)
104
105Whether to execute on the trailing edge of the timeout.
106Defaults to true.
107
108***
109
110### wait
111
112```ts
113wait: number | ((debouncer) => number);
114```
115
116Defined in: [debouncer.ts:85](https://github.com/TanStack/pacer/blob/main/packages/pacer/src/debouncer.ts#L85)
117
118Delay in milliseconds before executing the function.
119Can be a number or a function that returns a number.
120Defaults to 0ms