📄 useMemory¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 1 |
| 📦 Imports | 6 |
| 📐 Interfaces | 3 |
| 📑 Type Aliases | 1 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/core/useMemory/index.ts
📦 Imports¶
| Name | Source |
|---|---|
ShallowRef |
vue |
ConfigurableScheduler |
../_configurable |
Supportable |
../types |
useIntervalFn |
@vueuse/shared |
shallowRef |
vue |
useSupported |
../useSupported |
Functions¶
useMemory(options: UseMemoryOptions): UseMemoryReturn¶
Reactive Memory Info.
Parameters:
optionsany: No description
See: https://vueuse.org/useMemory
Tags: @__NO_SIDE_EFFECTS__
Raw JSDoc
Calls:
shallowRef (from vue)useSupported (from ../useSupported)scheduler
Code
export function useMemory(options: UseMemoryOptions = {}): UseMemoryReturn {
const memory = shallowRef<MemoryInfo>()
const isSupported = useSupported(() => typeof performance !== 'undefined' && 'memory' in performance)
if (isSupported.value) {
const {
scheduler = useIntervalFn,
} = options
scheduler(() => {
memory.value = (performance as PerformanceMemory).memory
})
}
return { isSupported, memory }
}
Interfaces¶
MemoryInfo¶
Interface Code
export interface MemoryInfo {
/**
* The maximum size of the heap, in bytes, that is available to the context.
*/
readonly jsHeapSizeLimit: number
/**
* The total allocated heap size, in bytes.
*/
readonly totalJSHeapSize: number
/**
* The currently active segment of JS heap, in bytes.
*/
readonly usedJSHeapSize: number
[Symbol.toStringTag]: 'MemoryInfo'
}
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
jsHeapSizeLimit |
number |
✗ | not shown |
totalJSHeapSize |
number |
✗ | not shown |
usedJSHeapSize |
number |
✗ | not shown |
[Symbol.toStringTag] |
'MemoryInfo' |
✗ | not shown |
UseMemoryOptions¶
UseMemoryReturn¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
memory |
ShallowRef<MemoryInfo \| undefined> |
✗ | not shown |
Type Aliases¶
PerformanceMemory¶
Generated by Syntax Scribe