Files
klz-cables.com/.pnpm-store/v10/files/36/198d35b299ea8764e31cc993413efb942000cdec620861febcbe2d74ad43fdd7fbf2a567efbf0f8c95154eb610a094bdcd56199fa95d64182d942d19f770d6
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

26 lines
1.2 KiB
Plaintext

// Type definitions for state-local v0.0.1
// Project: state-local
// Definitions by: Suren Atoyan contact@surenatoyan.com
export as namespace state;
export type State = Record<string, unknown>;
export type Selector = (state: State) => State;
export type ChangeGetter = (state: State) => State;
export type GetState = (selector?: Selector) => State;
export type SetState = (change: State | ChangeGetter) => void;
export type StateUpdateHandler = (update: State) => unknown;
export type FieldUpdateHandler = (update: any) => unknown;
export type Handlers = Record<string, FieldUpdateHandler>;
/**
* `state.create` is a function with two parameters:
* the first one (required) is the initial state and it should be a non-empty object
* the second one (optional) is the handler, which can be function or object
* if the handler is a function than it should be called immediately after every state update
* if the handler is an object than the keys of that object should be a subset of the state
* and the all values of that object should be functions, plus they should be called immediately
* after every update of the corresponding field in the state
*/
export function create(initial: State, handler?: StateUpdateHandler | Handlers): [GetState, SetState];