Memory

Reactive Memory Info.

Usage

<script>
    import {memory} from "@sveu/browser"

    const {supported, result} = memory()
</script>
<script>
    import {memory} from "@sveu/browser"

    const {supported, result} = memory()
</script>
svelte

Example

Supported: false

Js Heap Size Limit: undefined

Total Js Heap: undefined

Used Js Heap: undefined

<script>
    import { memory } from "@sveu/browser"

    const { supported, result } = memory()
</script>

<div class="text-center">
    <h1>Supported: {$supported}</h1>

    <h2>Js Heap Size Limit: {$result?.jsHeapSizeLimit}</h2>

    <h2>Total Js Heap: {$result?.totalJSHeapSize}</h2>

    <h2>Used Js Heap: {$result?.usedJSHeapSize}</h2>
</div>
<script>
    import { memory } from "@sveu/browser"

    const { supported, result } = memory()
</script>

<div class="text-center">
    <h1>Supported: {$supported}</h1>

    <h2>Js Heap Size Limit: {$result?.jsHeapSizeLimit}</h2>

    <h2>Total Js Heap: {$result?.totalJSHeapSize}</h2>

    <h2>Used Js Heap: {$result?.usedJSHeapSize}</h2>
</div>
svelte
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Click fold/expand code

API

Options

Name Description Type
interval The interval in seconds to check the memory. number
IntervalFnOptions See
IntervalFnOptions
.
IntervalFnOptions


Returns

Name Description Type
supported If the browser supports the memory API. boolean
result A readable store with the memory info. Readable<MemoryInfo>