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>
64 lines
1.4 KiB
Markdown
64 lines
1.4 KiB
Markdown
---
|
|
category: State
|
|
---
|
|
|
|
# useLastChanged
|
|
|
|
Records the timestamp of the last change
|
|
|
|
## Usage
|
|
|
|
```ts
|
|
import { useLastChanged } from '@vueuse/core'
|
|
import { nextTick } from 'vue'
|
|
|
|
const a = ref(0)
|
|
const lastChanged = useLastChanged(a)
|
|
|
|
a.value = 1
|
|
|
|
await nextTick()
|
|
|
|
console.log(lastChanged.value) // 1704709379457
|
|
```
|
|
|
|
By default the change is recorded on the next tick (`watch()` with `flush: 'post'`). If you want to record the change immediately, pass `flush: 'sync'` as the second argument.
|
|
|
|
```ts
|
|
import { useLastChanged } from '@vueuse/core'
|
|
|
|
const a = ref(0)
|
|
const lastChanged = useLastChanged(a, { flush: 'sync' })
|
|
|
|
a.value = 1
|
|
|
|
console.log(lastChanged.value) // 1704709379457
|
|
```
|
|
|
|
## Type Declarations
|
|
|
|
```ts
|
|
export interface UseLastChangedOptions<
|
|
Immediate extends boolean,
|
|
InitialValue extends number | null | undefined = undefined,
|
|
> extends WatchOptions<Immediate> {
|
|
initialValue?: InitialValue
|
|
}
|
|
export type UseLastChangedReturn =
|
|
| Readonly<ShallowRef<number | null>>
|
|
| Readonly<ShallowRef<number>>
|
|
/**
|
|
* Records the timestamp of the last change
|
|
*
|
|
* @see https://vueuse.org/useLastChanged
|
|
*/
|
|
export declare function useLastChanged(
|
|
source: WatchSource,
|
|
options?: UseLastChangedOptions<false>,
|
|
): Readonly<ShallowRef<number | null>>
|
|
export declare function useLastChanged(
|
|
source: WatchSource,
|
|
options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>,
|
|
): Readonly<ShallowRef<number>>
|
|
```
|