You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
difficulty: hardtitle: useDebouncetags: Composable Function
Question
For this challenge, you need implement a debounce Composable Function. Let's go.
importtype{Ref}from'vue'interfaceUseDebounceOptions{leading?: boolean// Specify invoking on the leading edge of the timeout.maxWait?: number// The maximum time func is allowed to be delayed before it's invoked.trailing?: boolean// Specify invoking on the trailing edge of the timeout.}typeMaybeRef<T>=T|Ref<T>typeUseDebounce=<Textends(...args: any[])=>any>(fn: T,wait: MaybeRef<number>,options?: UseDebounceOptions)=>T/** * useDebounce * @param fn The function to debounce. * @param wait The number of milliseconds to delay. * @param options The options object. * @return Returns the new debounced function. */constuseDebounce: UseDebounce=(fn,wait,options)=>{// do someting...}
Template
filename: useDebounce.ts
importtype{Ref}from'vue'interfaceUseDebounceOptions{leading?: boolean// Specify invoking on the leading edge of the timeout.maxWait?: number// The maximum time func is allowed to be delayed before it's invoked.trailing?: boolean// Specify invoking on the trailing edge of the timeout.}typeMaybeRef<T>=T|Ref<T>typeUseDebounce=<Textends(...args: any[])=>any>(fn: T,wait: MaybeRef<number>,options?: UseDebounceOptions)=>T/** * useDebounce * @param fn The function to debounce. * @param wait The number of milliseconds to delay. * @param options The options object. * @return Returns the new debounced function. */constuseDebounce: UseDebounce=(fn,wait,options)=>{// do someting...}
The text was updated successfully, but these errors were encountered:
Info
Basic info of your challenge questions,
Question
For this challenge, you need implement a debounce Composable Function. Let's go.
Template
filename: useDebounce.ts
The text was updated successfully, but these errors were encountered: