@manyducks.co/dolla 0.69.3 → 0.69.5

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.
package/lib/app.d.ts CHANGED
@@ -53,9 +53,6 @@ interface ConfigureContext {
53
53
  type ConfigureCallback = (ctx: ConfigureContext) => void | Promise<void>;
54
54
  export interface IApp {
55
55
  readonly isConnected: boolean;
56
- /**
57
- * Makes this store accessible from any other component in the app, except for stores registered before this one.
58
- */
59
56
  /**
60
57
  * Runs `callback` after app-level stores are connected to the app, but before views are connected to the DOM.
61
58
  * Use this function to run async configuration code before displaying content to the user.
@@ -0,0 +1,44 @@
1
+ type EventListeners<E extends EventMap> = {
2
+ [K in keyof E]?: EventCallback<E, K>[];
3
+ };
4
+ export type EventCallback<E extends EventMap, K extends keyof E> = (event: EmittedEvent<E, K>) => void;
5
+ /**
6
+ * A map of event names and data values that their listener callbacks take.
7
+ */
8
+ export interface EventMap {
9
+ [name: string]: any;
10
+ }
11
+ /**
12
+ * A hub for subscribing to and emitting events. A good pattern when you want to notify several parts of your app
13
+ * at once when a condition changes in a central location. This is a similar pattern to Readable and Writable as far as
14
+ * observability goes, but with the added ability to emit multiple event types each with their own separate listeners.
15
+ */
16
+ export declare class EventEmitter<E extends EventMap = EventMap> {
17
+ listeners: EventListeners<E>;
18
+ /**
19
+ * Emit an event.
20
+ */
21
+ emit<K extends keyof E>(name: K, data: E[K]): void;
22
+ /**
23
+ * Listen for an event. The callback will be called whenever that event is emitted.
24
+ * Returns a function that will cancel this listener when called.
25
+ */
26
+ on<K extends keyof EventListeners<E>>(name: K, callback: EventCallback<E, K>): () => void;
27
+ /**
28
+ * Listen for the next emitted event. The callback will be called once the next time that event is emitted,
29
+ * and then never again. Returns a function that will cancel this listener when called.
30
+ */
31
+ once<K extends keyof EventListeners<E>>(name: K, callback: EventCallback<E, K>): () => void;
32
+ /**
33
+ * Cancel a listener by passing the callback that was originally used to register it.
34
+ */
35
+ off<K extends keyof EventListeners<E>>(name: K, callback: EventCallback<E, K>): void;
36
+ }
37
+ declare class EmittedEvent<E extends EventMap, K extends keyof E> {
38
+ /**
39
+ * Data object emitted with this event.
40
+ */
41
+ data: E[K];
42
+ constructor(data: E[K]);
43
+ }
44
+ export {};