diff options
| -rw-r--r-- | src/shapex.ts | 22 |
1 files changed, 22 insertions, 0 deletions
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<T> = { * An instance of the ShapeX object. */ export type ShapeXInstance<T> = { + /** + * Subcribe to an event. + */ subscribe: (listener: string, callback: EventCallback<T>) => number; + /** + * Subscribe to an event once. + */ subscribeOnce: (listener: string, callback: EventCallback<T>) => 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; }; |
