ServerStorage
Provides request-scoped browser-like storage during server rendering.
Table of contents
Category
Value
Import
jsimport { ServerStorage } from "valyrian.js/node";Public signature
tsServerStorage.run<T>(callback: () => T): TAPI form
ServerStorage is a class with a static request-boundary method. Use ServerStorage.run(...) around each complete server request. Inside that callback, global sessionStorage and localStorage use the active isolated storage context.
Static methods
tsServerStorage.run<T>(callback: () => T): T
ServerStorage.isContextActive(): booleanStorage surface inside a request
tslength: number
clear(): void
getItem(key: string): string | null
key(index: number): string | null
removeItem(key: string): void
setItem(key: string, value: string): void
toJSON(): Record<string, string>Request isolation
ServerStorage.run preserves its context through synchronous and asynchronous work returned by the callback. Wrap the full request lifecycle so concurrent requests do not share storage values.