fn
useTimestamp
v0.0.15testeddemoReactive current timestamp, updated via `requestAnimationFrame` or a fixed interval.
Examples
ts
const now = useTimestamp();ts
const { timestamp, pause, resume, isActive } = useTimestamp({ controls: true, interval: 1000 });ts
// Reactive offset
const offset = ref(0);
const now = useTimestamp({ offset });Demo
Loading demo…
Signatures
ts
export function useTimestamp(options?: UseTimestampOptions<false>): Ref<number>;ts
export function useTimestamp(options: UseTimestampOptions<true>): UseTimestampControls;Parameters
| Parameter | Type | Description |
|---|---|---|
options? | UseTimestampOptions<boolean> | Options |
Returns
Ref<number, number> | UseTimestampControlsThe timestamp, or controls when `controls: true`