Skip to main content
Home
This package works with Node.js, Bun, BrowsersIt is unknown whether this package works with Cloudflare Workers, Deno
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
It is unknown whether this package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
58%
Published
a year ago (0.1.0)
class Store
extends CentralStore

Constructors

new
Store(
storeName: string,
storeState: StoreState,
storeActions: Actions,
storeOptions?,
)

Type Parameters

StoreState
Actions extends StoreActions<StoreState>

Properties

readonly
actions: Actions
private
readonly
initialState: StoreState
readonly
name: string
private
readonly
reduxDevtoolsConnection: ReduxDevtoolsConnection
readonly
state: Immutable<StoreState>
private
readonly
storeListeners: Map<string, (
newState: Immutable<StoreState>,
prevState: Immutable<StoreState>,
) => void>

Methods

dispatch<T extends keyof Actions>(
actionKey: T,
payLoadCallback: (storeState: Immutable<StoreState>) => Parameters<Actions[T]>[0],
): ReturnType<Actions[T]>
isInputFunction(input: unknown): input is (state: Immutable<StoreState>) => Immutable<StoreState>
isPropertyInputFunction<T extends keyof StoreState>(input: unknown): input is (state: Immutable<StoreState>) => StoreState[T]
private
onStoreChanged(
newState: Immutable<StoreState>,
prevState: Immutable<StoreState>,
actionKey: keyof Actions,
payload: unknown,
): void
reset(): void

Reset store back to initial state

subscribeToStoreChange(onStoreChangedCallback: (
newState: Immutable<StoreState>,
prevState: Immutable<StoreState>,
) => void
): () => boolean
updateProperty<T extends keyof StoreState>(
key: T,
callback: (state: Immutable<StoreState>) => StoreState[T],
): void

Directly update a property in the store state using the current store state

updateProperty<T extends keyof StoreState>(
key: T,
value: StoreState[T],
): void

Directly update a property in the store state

updateProperty<T extends keyof StoreState>(
key: T,
input: StoreState[T] | ((state: Immutable<StoreState>) => StoreState[T]),
): void
updateState(callback: (state: Immutable<StoreState>) => Immutable<StoreState>): void

Directly update the store state using the current store state

updateState(state: Immutable<StoreState>): void

Directly update the store state

private
updateStoreProperty<T extends keyof StoreState>(
key: T,
value: StoreState[T],
actionKey: keyof Actions,
payload: unknown,
): void
private
updateStoreState(
state: Immutable<StoreState>,
actionKey: keyof Actions,
payload: unknown,
): void

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@skyblazar/react-store

Import symbol

import { Store } from "@skyblazar/react-store";
or

Import directly with a jsr specifier

import { Store } from "jsr:@skyblazar/react-store";

Add Package

pnpm i jsr:@skyblazar/react-store
or (using pnpm 10.8 or older)
pnpm dlx jsr add @skyblazar/react-store

Import symbol

import { Store } from "@skyblazar/react-store";

Add Package

yarn add jsr:@skyblazar/react-store
or (using Yarn 4.8 or older)
yarn dlx jsr add @skyblazar/react-store

Import symbol

import { Store } from "@skyblazar/react-store";

Add Package

vlt install jsr:@skyblazar/react-store

Import symbol

import { Store } from "@skyblazar/react-store";

Add Package

npx jsr add @skyblazar/react-store

Import symbol

import { Store } from "@skyblazar/react-store";

Add Package

bunx jsr add @skyblazar/react-store

Import symbol

import { Store } from "@skyblazar/react-store";