@jay-js/system
Version:
A powerful and flexible TypeScript library for UI, state management, lazy loading, routing and managing draggable elements in modern web applications.
29 lines (28 loc) • 902 B
TypeScript
/**
* Subscriber manager for the state system
* Isolates the logic of managing the current subscriber and avoids using global variables
*/
declare class SubscriberManager {
private _current;
/**
* Sets the current subscriber
* @param subscriber Function to be set as the current subscriber
*/
setSubscriber(subscriber: ((args?: any) => void | Promise<void>) | null): void;
/**
* Gets the current subscriber
* @returns The current subscriber or null if none exists
*/
getSubscriber(): ((args?: any) => void | Promise<void>) | null;
/**
* Checks if there is an active subscriber
* @returns true if there is an active subscriber, false otherwise
*/
hasSubscriber(): boolean;
/**
* Clears the current subscriber
*/
clearSubscriber(): void;
}
export declare const subscriberManager: SubscriberManager;
export {};