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