All skills
skilld-dev avatar

/vueuse-shared-skilld

@b9c39cb

Use when writing, reviewing, or debugging code that imports from "@vueuse/shared" (or its utilities re-exported by "@vueuse/core"). Provides the v15.0.0 API surface, debounce and throttle defaults, watch variants, state-sharing patterns, and v14 to v15 migration rules.

Use this Skill: https://skilld.dev/gh/skilld-dev/vue-ecosystem-skills/vueuse-shared-skilld

This session only. Nothing lands on disk.

referenceswatch-utilities.md

≈920 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Watch utilities, @vueuse/shared 15.0.0

All variants forward sources and options to Vue's watch; most return a WatchHandle (dist/index.d.ts:1386-1509).

Shorthands

Export Equivalent Source
watchDeep(src, cb, opts) watch(src, cb, { ...opts, deep: true }) dist/index.js:1867-1872
watchImmediate(src, cb, opts) watch(src, cb, { ...opts, immediate: true }) dist/index.js:1936-1941
watchOnce(src, cb, opts) watch(src, cb, { ...opts, once: true }) dist/index.js:1949-1954

Prefer Vue's native { deep: true }, { immediate: true }, { once: true } options when you do not need a named import; the shorthands exist for readability.

watchWithFilter

watch(src, cb, { ...watchOptions, eventFilter }): route callbacks through a filter such as debounceFilter or pausableFilter (dist/index.js:1015-1018). See debounce-throttle.

watchIgnorable

Returns { stop, ignoreUpdates, ignorePrevAsyncUpdates } (dist/index.d.ts:1430-1443).

const { stop, ignoreUpdates } = watchIgnorable(source, cb)

ignoreUpdates(() => {
  source.value = 'silent' // cb will not fire for this write
})

Implementation differs by flush: with flush: 'sync' a flag suppresses the callback; otherwise two watches count updates (dist/index.js:1881-1919). ignorePrevAsyncUpdates() discards updates queued since the last callback and is a no-op with flush: 'sync'.

watchAtMost

watchAtMost(src, cb, { count, ...opts }) stops automatically after count fires; returns { stop, pause, resume, count } where count is a ShallowRef<number> tally (dist/index.js:1834-1848, dist/index.d.ts:1401-1413). count is required.

watchTriggerable

watchIgnorable plus trigger(): run the callback immediately with current values, ignoring the resulting update, returning the callback's value (dist/index.js:1968-1997, dist/index.d.ts:1480-1489). Callback signature (value, oldValue, onCleanup) => R.

watchArray

Diffing watch for arrays; the callback receives (newList, oldList, added, removed, onCleanup) (dist/index.js:1813-1831). Elements are matched by identity. With immediate: true the first callback reports the whole list as added (old starts [], dist/index.js:1814).

watchPausable (deprecated)

All overloads are deprecated in favor of Vue's built-in watch whose handle has pause() / resume() (dist/index.js:1021). If you need a shared pausable gate for several effects, use pausableFilter instead.

until

Promised one-time watch (dist/index.js:1181-1276, dist/index.d.ts:835-889).

await until(isReady).toBe(true)
await until(count).toMatch(v => v > 7)
await until(list).toContains(item)      // array sources get toContains
await until(source).changed()
await until(source).changedTimes(3)
await until(flag).not.toBeTruthy()
await until(val).toBe(target, { timeout: 1000, throwOnTimeout: true })
  • Options { flush = 'sync', deep = false, timeout?, throwOnTimeout? }; without throwOnTimeout a timeout resolves with the current value instead of throwing (dist/index.js:1182, 1197).
  • toBe accepts a ref or getter as the comparand and watches both sides (dist/index.js:1200-1210).
  • Any Promise.race consumer can race it; each call creates its own watch, which stops on resolution.

whenever

watch that only fires while the source is truthy; the callback receives the truthy value (dist/index.js:2008-2019). { once: true } stops the watcher on nextTick after the first fire (dist/index.js:2011). All other options match watch.

whenever(isReady, data => init(data), { once: true })

Source: SKILL.md on GitHub

1 warning9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    This skill is a comprehensive documentation and reference package for the @vueuse/shared library. It contains detailed API information, best practices, release notes, and community discussion logs to assist an AI agent in writing and debugging Vue code.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: MEDIUM · 1 issue

Signed by skilld at b9c39cb. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated last week

README badge

README badge for skilld-dev/vue-ecosystem-skills/vueuse-shared-skilld