@@ -127,21 +127,34 @@ declare module "@uidotdev/usehooks" {
127
127
( value : string ) => Promise < void >
128
128
] ;
129
129
130
+ export function useContinuousRetry (
131
+ callback : ( ) => any ,
132
+ interval ?: number ,
133
+ options ?: {
134
+ maxRetries ?: number
135
+ } ) : boolean ;
136
+
137
+ export function useCountdown ( endTime : number , options : {
138
+ interval : number ,
139
+ onComplete : ( ) => any ,
140
+ onTick : ( ) => any
141
+ } ) : number ;
142
+
130
143
export function useCounter (
131
144
startingValue ?: number ,
132
145
options ?: {
133
146
min ?: number ;
134
147
max ?: number ;
135
148
}
136
149
) : [
137
- number ,
138
- {
139
- increment : ( ) => void ;
140
- decrement : ( ) => void ;
141
- set : ( nextCount : number ) => void ;
142
- reset : ( ) => void ;
143
- }
144
- ] ;
150
+ number ,
151
+ {
152
+ increment : ( ) => void ;
153
+ decrement : ( ) => void ;
154
+ set : ( nextCount : number ) => void ;
155
+ reset : ( ) => void ;
156
+ }
157
+ ] ;
145
158
146
159
export function useDebounce < T > ( value : T , delay : number ) : T ;
147
160
@@ -152,8 +165,25 @@ declare module "@uidotdev/usehooks" {
152
165
153
166
export function useDocumentTitle ( title : string ) : void ;
154
167
168
+ export function useEventListener (
169
+ target : React . MutableRefObject < Element > | Element ,
170
+ eventName : string ,
171
+ handler : ( Event ) => any ,
172
+ options ?: {
173
+ capture ?: boolean ,
174
+ passive ?: boolean ,
175
+ once ?: boolean
176
+ } ) : void ;
177
+
155
178
export function useFavicon ( url : string ) : void ;
156
179
180
+ export function useFetch (
181
+ url : string ,
182
+ options ?: { } ) : {
183
+ error : Error | undefined ,
184
+ data : any | undefined
185
+ }
186
+
157
187
export function useGeolocation ( options ?: PositionOptions ) : GeolocationState ;
158
188
159
189
export function useHistoryState < T > ( initialPresent ?: T ) : HistoryState < T > ;
@@ -169,14 +199,35 @@ declare module "@uidotdev/usehooks" {
169
199
options ?: IntersectionObserverInit
170
200
) : [ React . MutableRefObject < Element > , IntersectionObserverEntry | null ] ;
171
201
202
+ export function useInterval ( cb : ( ) => any , ms : number ) : ( ) => void ;
203
+
204
+ export function useIntervalWhen (
205
+ cb : ( ) => any ,
206
+ options : {
207
+ ms : number ,
208
+ when : boolean ,
209
+ startImmediately ?: boolean
210
+ } ) : ( ) => void ;
211
+
172
212
export function useIsClient ( ) : boolean ;
173
213
174
214
export function useIsFirstRender ( ) : boolean ;
175
215
216
+ export function useKeyPress (
217
+ key : string ,
218
+ cb : ( Event ) => any ,
219
+ options ?: {
220
+ event ?: string ,
221
+ target ?: Element | Window ,
222
+ eventOptions ?: { }
223
+ } ) : void ;
224
+
176
225
export function useList < T > ( defaultList ?: T [ ] ) : [ T [ ] , CustomList < T > ] ;
177
226
178
227
export function useLockBodyScroll ( ) : void ;
179
228
229
+ export function useLogger ( name : string , ...rest : any [ ] ) : void ;
230
+
180
231
export function useLongPress (
181
232
callback : ( e : Event ) => void ,
182
233
options ?: LongPressOptions
@@ -208,12 +259,19 @@ declare module "@uidotdev/usehooks" {
208
259
type : string ;
209
260
} ;
210
261
262
+ export function usePageLeave ( cb : ( ) => any ) : void ;
263
+
211
264
export function usePreferredLanguage ( ) : string ;
212
265
213
266
export function usePrevious < T > ( newValue : T ) : T ;
214
267
215
268
export function useQueue < T > ( initialValue ?: T [ ] ) : CustomQueue < T > ;
216
269
270
+ export function useRandomInterval ( cb : ( ) => any , options : {
271
+ minDelay : number ,
272
+ maxDelay : number
273
+ } ) : ( ) => void ;
274
+
217
275
export function useRenderCount ( ) : number ;
218
276
219
277
export function useRenderInfo ( name ?: string ) : RenderInfo | undefined ;
@@ -231,6 +289,8 @@ declare module "@uidotdev/usehooks" {
231
289
232
290
export function useThrottle < T > ( value : T , delay : number ) : T ;
233
291
292
+ export function useTimeout ( cb : ( ) => any , ms : number ) : ( ) => void ;
293
+
234
294
export function useToggle (
235
295
initialValue ?: boolean
236
296
) : [ boolean , ( newValue ?: boolean ) => void ] ;
0 commit comments