@monterosa/sdk-util 2.0.0-rc.1 → 2.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,8 @@
8
8
  * More details on the license can be found at https://www.monterosa.co/sdk/license
9
9
  */
10
10
  /**
11
+ * @internal
12
+ *
11
13
  * FNV-1a 32-bit hash function
12
14
  * Produces a fast, non-cryptographic checksum for strings
13
15
  *
package/dist/emitter.d.ts CHANGED
@@ -7,13 +7,43 @@
7
7
  * More details on the license can be found at https://www.monterosa.co/sdk/license
8
8
  */
9
9
  type Handler = (...args: any[]) => void;
10
+ /**
11
+ * @internal
12
+ *
13
+ * Event emitter. Provides subscribe/unsubscribe pattern used throughout
14
+ * the SDK for observable state changes.
15
+ */
10
16
  export declare class Emitter {
11
- private readonly emitter;
12
- private readonly handlers;
13
- constructor();
17
+ private readonly listeners;
18
+ /**
19
+ * Subscribes to an event.
20
+ *
21
+ * @param event - The event name
22
+ * @param handler - The callback function
23
+ * @returns A function that unsubscribes the handler when called
24
+ */
14
25
  on(event: string, handler: Handler): Unsubscribe;
26
+ /**
27
+ * Unsubscribes from an event.
28
+ *
29
+ * @param event - The event name
30
+ * @param handler - The handler to remove. If omitted, all handlers for the event are removed.
31
+ */
15
32
  off(event: string, handler?: Handler): void;
33
+ /**
34
+ * Emits an event with optional arguments.
35
+ *
36
+ * @param event - The event name
37
+ * @param args - Arguments to pass to handlers
38
+ */
16
39
  emit(event: string, ...args: any[]): void;
40
+ /**
41
+ * Subscribes to an event and automatically unsubscribes after the first call.
42
+ *
43
+ * @param event - The event name
44
+ * @param handler - The callback function
45
+ * @returns A function that unsubscribes the handler when called
46
+ */
17
47
  once(event: string, handler: Handler): Unsubscribe;
18
48
  }
19
49
  /**
package/dist/error.d.ts CHANGED
@@ -8,8 +8,8 @@
8
8
  */
9
9
  /**
10
10
  * MonterosaError extends the standard JavaScript `Error` object. It has
11
- * an error code so that user can identify the error. Also it has it's own
12
- * specific `name` "MonterosaError"
11
+ * an error code so that users can identify the error. It also has its
12
+ * own specific `name` "MonterosaError".
13
13
  */
14
14
  export declare class MonterosaError extends Error {
15
15
  /**
@@ -7,4 +7,7 @@
7
7
  *
8
8
  * More details on the license can be found at https://www.monterosa.co/sdk/license
9
9
  */
10
+ /**
11
+ * @internal
12
+ */
10
13
  export declare function fromEntries(entries: [string | number | symbol, any][]): Record<string | number | symbol, any>;