From 55b57c94f8be99f3a80e58966451c8004b9bdad6 Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Fri, 18 Apr 2025 19:02:36 +0300 Subject: Update documentation --- src/shapex.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/shapex.ts b/src/shapex.ts index fc829a4..3d9fd21 100644 --- a/src/shapex.ts +++ b/src/shapex.ts @@ -40,11 +40,33 @@ type Subscription = { * An instance of the ShapeX object. */ export type ShapeXInstance = { + /** + * Subcribe to an event. + */ subscribe: (listener: string, callback: EventCallback) => number; + /** + * Subscribe to an event once. + */ subscribeOnce: (listener: string, callback: EventCallback) => number; + + /** + * Unsubscribe from an event. + */ unsubscribe: (listener: string) => void; + + /** + * Get the number of subscriptions for an event. + */ subscriptionCount: (eventName: string) => number; + + /** + * Get the subscriptions for an event. + */ subscriptions: () => string[]; + + /** + * Dispatch an event. + */ dispatch: (eventName: string, ...args: unknown[]) => void; }; -- cgit v1.2.3