Skip to content

useMemory

Category
Export Size
538 B
Last Changed
3 weeks ago

Reactive Memory Info.

Demo

Used
27.73 MB
Allocated
31.89 MB
Limit
4095.75 MB

Usage

ts
import { 
useMemory
} from '@vueuse/core'
const {
isSupported
,
memory
} =
useMemory
()

Type Declarations

ts
/**
 * Performance.memory
 *
 * @see https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory
 */
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"
} export interface UseMemoryOptions extends UseIntervalFnOptions {
interval
?: number
} /** * Reactive Memory Info. * * @see https://vueuse.org/useMemory * @param options * * @__NO_SIDE_EFFECTS__ */ export declare function
useMemory
(
options
?: UseMemoryOptions): {
isSupported
:
ComputedRef
<boolean>
memory
:
Ref
<MemoryInfo | undefined, MemoryInfo | undefined>
} export type
UseMemoryReturn
=
ReturnType
<typeof
useMemory
>

Source

SourceDemoDocs

Contributors

Anthony Fu
Jelf
SerKo
Anthony Fu
webfansplz

Changelog

v13.6.0 on
d32f8 - refactor: add @__NO_SIDE_EFFECTS__ annotations to all pure functions (#4907)
v12.0.0-beta.1 on
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)

Released under the MIT License.

FREE WEEKEND
48 Hours of Unlimited Official Vue.js Certification Training
Reserve Your Spot
23-24 August