Skip to content

Storage

Storage system interfaces and factory types.

Interface for storage systems.

NameTypeDescription
get() => TGet the current value.
set(value: T) => voidSet a new value.
subscribe(listener: Listener<T>) => () => voidSubscribe to value changes.

Factory function for creating storage systems.

type StorageFactory<T> = (initial: T) => StorageSystem<T>

Creates a storage system from a factory.

import { createStorage, StorageFactory } from '@reaxium/core';
function createStorage<T>(
factory?: StorageFactory<T>
): (initial: T) => StorageSystem<T>
NameTypeDescription
factoryStorageFactory<T>(Optional) Storage factory.
const storage = createStorage()(0);