Skip to content
LogoLogo

Storage.defaultStorage

Returns the default storage for the current environment as a singleton.

  • Browser: sessionStorage
  • Server/unsupported: in-memory Map-based storage

Returns the same instance on every call so that the zone transport and actions share the same storage without explicit plumbing.

Usage

import { Storage } from 'viem/tempo'
 
const storage = Storage.defaultStorage()
 
await storage.setItem('key', 'value')
const value = await storage.getItem('key')
'value'

Return Type

type ReturnType = Storage

A singleton Storage instance for the current environment.