Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.7 KiB
1.7 KiB
category, alias
| category | alias |
|---|---|
| Reactivity | useDebounce, debouncedRef |
refDebounced
Debounce execution of a ref value.
Usage
import { refDebounced } from '@vueuse/core'
import { shallowRef } from 'vue'
const input = shallowRef('foo')
const debounced = refDebounced(input, 1000)
input.value = 'bar'
console.log(debounced.value) // 'foo'
await sleep(1100)
console.log(debounced.value) // 'bar'
// ---cut-after---
function sleep(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms))
}
An example with object ref.
import { refDebounced } from '@vueuse/core'
import { shallowRef } from 'vue'
const data = shallowRef({
name: 'foo',
age: 18,
})
const debounced = refDebounced(data, 1000)
function update() {
data.value = {
...data.value,
name: 'bar',
}
}
console.log(debounced.value) // { name: 'foo', age: 18 }
update()
await sleep(1100)
console.log(debounced.value) // { name: 'bar', age: 18 }
You can also pass an optional 3rd parameter including maxWait option. See useDebounceFn for details.
Recommended Reading
Type Declarations
export type RefDebouncedReturn<T = any> = Readonly<Ref<T>>
/**
* Debounce updates of a ref.
*
* @return A new debounced ref.
*/
export declare function refDebounced<T>(
value: Ref<T>,
ms?: MaybeRefOrGetter<number>,
options?: DebounceFilterOptions,
): RefDebouncedReturn<T>
/** @deprecated use `refDebounced` instead */
export declare const debouncedRef: typeof refDebounced
/** @deprecated use `refDebounced` instead */
export declare const useDebounce: typeof refDebounced