summaryrefslogtreecommitdiff
path: root/src/shapex.ts
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2025-04-18 19:02:36 +0300
committerAsko Nõmm <asko@nmm.ee>2025-04-18 19:02:36 +0300
commit55b57c94f8be99f3a80e58966451c8004b9bdad6 (patch)
tree5acfb1724509ce8c08eb69f9bce33c474b2c0393 /src/shapex.ts
parentd7bc505e49b44b15b487cad1f30a37384f704b72 (diff)
Update documentation
Diffstat (limited to 'src/shapex.ts')
-rw-r--r--src/shapex.ts22
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;
};