useBrowserMemory

A React Hook that helps to get the memory info of the browser.

Demo

Source
Supported:
false
Timestamp:
1747907763961
Used:
0.00 MB
Allocated:
0.00 MB
Limit:
0.00 MB

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

const memory = useBrowserMemory(options)

Options

export type UseBrowserMemoryOptions = UseIntervalFnOptions & {
  interval?: number
}

Returns

export type UseBrowserMemoryReturns = {
  /**
   * The timestamp when the memory info was last updated.
   */
  timestamp: number
  /**
   * The memory info.
   */
  memory: MemoryInfo | undefined
  /**
   * The maximum size of the heap, in bytes, that is available to the context.
   */
  jsHeapSizeLimit: number
  /**
   * The total allocated heap size, in bytes.
   */
  totalJSHeapSize: number
  /**
   * The used heap size, in bytes.
   */
  usedJSHeapSize: number
  /**
   *  Whether the browser supports the `Performance.memory` API.
   */
  isSupported: boolean
  /**
   * Update the memory info.
   */
  update(): void
}