@liquidcommerceteam/elements-sdk
Version:
LiquidCommerce Elements SDK
45 lines (44 loc) • 1.72 kB
TypeScript
import { PubSubService } from '@/core/pubsub/pubsub.service';
import type { IElementsActionsEventsMap, IElementsFormsEventsMap, IEventMetadata, PubSubUnsubscribe, SpecificActionEvent, SpecificFormEvent } from '@/core/pubsub';
export declare class LiquidCommerceElementsEvents {
protected readonly pubSubService: PubSubService;
/**
* Emit action events
*/
emitAction<K extends SpecificActionEvent>(eventType: K, data: IElementsActionsEventsMap[K]): void;
/**
* Emit form events
*/
emitForm<K extends SpecificFormEvent>(eventType: K, data: IElementsFormsEventsMap[K]): void;
/**
* Subscribe to specific action events
*/
onAction<K extends SpecificActionEvent>(eventType: K, callback: (data: IElementsActionsEventsMap[K], metadata: IEventMetadata) => void): PubSubUnsubscribe;
/**
* Subscribe to specific form events
*/
onForm<K extends SpecificFormEvent>(eventType: K, callback: (data: IElementsFormsEventsMap[K], metadata: IEventMetadata) => void): PubSubUnsubscribe;
/**
* Subscribe to all actions using wildcard
*/
onAllActions(callback: (data: any, metadata: IEventMetadata) => void): PubSubUnsubscribe;
/**
* Subscribe to all forms using wildcard
*/
onAllForms(callback: (data: any, metadata: IEventMetadata) => void): PubSubUnsubscribe;
/**
* Subscribe to everything
*/
onAll(callback: (data: any, metadata: IEventMetadata) => void): PubSubUnsubscribe;
/**
* Get debug info about active subscriptions
*/
getDebugInfo(): {
granular: string[];
wildcard: string[];
};
/**
* Clear all event listeners
*/
clearAllListeners(): void;
}