fn
useLastChanged
v0.0.1testeddemoRecords the last time a value changed
Examples
ts
const value = ref(0);
const lastChanged = useLastChanged(value);ts
const value = ref(0);
const lastChanged = useLastChanged(value, { immediate: true });Demo
Loading demo…
Signatures
ts
export function useLastChanged(source: WatchSource, options?: UseLastChangedOptions<false>): Ref<number | null>;ts
export function useLastChanged(source: WatchSource, options: UseLastChangedOptions<true> | UseLastChangedOptions<boolean, number>): Ref<number>;Parameters
| Parameter | Type | Description |
|---|---|---|
source | WatchSource | The value to track |
options? | UseLastChangedOptions<boolean, any> | The options for the last changed tracker |
Returns
Ref<number, number> | Ref<number | null, number | null>The timestamp of the last change