UNPKG

react-antd-admin-panel

Version:

Modern TypeScript-first React admin panel builder with Ant Design 6

56 lines 1.51 kB
import type { Store as IStore, StateUpdater } from '../types'; type Subscriber<T = any> = (value: T) => void; /** * Global Store - Reactive key-value store for application state * Supports subscriptions for reactive updates * * @example * const store = new GlobalStore(); * store.set('theme', 'dark'); * store.subscribe('theme', (theme) => console.log('Theme changed:', theme)); * store.get<string>('theme'); // 'dark' */ export declare class GlobalStore implements IStore { private _data; private _subscribers; /** * Get a value from the store */ get<T = any>(key: string): T | undefined; /** * Set a value in the store * Notifies all subscribers of the change */ set<T = any>(key: string, value: T | StateUpdater<T>): void; /** * Remove a value from the store */ remove(key: string): void; /** * Clear all values from the store */ clear(): void; /** * Check if a key exists in the store */ has(key: string): boolean; /** * Get all keys in the store */ keys(): string[]; /** * Subscribe to changes for a specific key * Returns an unsubscribe function */ subscribe<T = any>(key: string, callback: Subscriber<T>): () => void; /** * Notify all subscribers of a value change */ private _notifySubscribers; /** * Get the store as a plain object */ toObject(): Record<string, any>; } export {}; //# sourceMappingURL=Store.d.ts.map