fn
useMemory
v0.0.14testeddemoReactive performance.memory heap statistics, polled on an
interval. SSR-safe and a no-op where the API is unavailable.
Examples
ts
const { isSupported, memory } = useMemory();
// memory.value?.usedJSHeapSizets
// Poll every 500ms
const { memory } = useMemory({ interval: 500 });Demo
Loading demo…
Signature
ts
export function useMemory(options: UseMemoryOptions ={ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
options? | UseMemoryOptions | Configuration options |
Returns
UseMemoryReturn{ isSupported, memory }| Property | Type | Description |
|---|---|---|
isSupported | ComputedRef<boolean> | Whether performance.memory is available in the current environment. |
memory | ShallowRef<MemoryInfo | undefined> | The latest performance.memory snapshot, or undefined until the first
sample is read (or when unsupported). |