R
fn

useLastChanged

v0.0.1testeddemo

Records 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

ParameterTypeDescription
sourceWatchSourceThe 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