@mappedin/mappedin-js 5.27.0 → 5.28.0

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.
@@ -178,7 +178,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue' {
178
178
  url: string;
179
179
  updated_at: string;
180
180
  }>;
181
- export function downloadMakerMVF(userOptions: TGetVenueMakerOptions): Promise<Uint8Array>;
181
+ export function downloadMVF(userOptions: TGetVenueMakerOptions): Promise<Uint8Array>;
182
182
  /**
183
183
  * Returns a {@link Mappedin} object hydrated with JSON data.
184
184
  * @param {string|Object} mappedinSerializableData A JSON string or object representing a venue.
@@ -1639,21 +1639,60 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/Mappedin.MVF.types' {
1639
1639
  }
1640
1640
 
1641
1641
  declare module '@mappedin/mappedin-js/lib/esm/get-venue/pub-sub.typed' {
1642
+ /**
1643
+ * Generic PubSub class implementing the Publish-Subscribe pattern for event handling.
1644
+ *
1645
+ * @template EVENT_PAYLOAD - The type of the event payload.
1646
+ * @template EVENT - The type of the event.
1647
+ */
1642
1648
  export class PubSub<EVENT_PAYLOAD, EVENT extends keyof EVENT_PAYLOAD> {
1643
1649
  /**
1644
1650
  * @private
1651
+ * @internal
1645
1652
  */
1646
1653
  _subscribers: any;
1647
1654
  /**
1648
1655
  * @private
1656
+ * @internal
1649
1657
  */
1650
1658
  publish<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, data?: EVENT_PAYLOAD[EVENT_NAME]): void;
1659
+ /**
1660
+ * Subscribe a function to an event.
1661
+ *
1662
+ * @param eventName An event name which, when fired, will call the provided
1663
+ * function.
1664
+ * @param fn A callback that gets called when the corresponding event is fired. The
1665
+ * callback will get passed an argument with a type that's one of event payloads.
1666
+ * @example
1667
+ * // Subscribe to the 'click' event
1668
+ * const handler = (event) => {
1669
+ * const { coordinate } = event;
1670
+ * const { latitude, longitude } = coordinate;
1671
+ * console.log(`Map was clicked at ${latitude}, ${longitude}`);
1672
+ * };
1673
+ * map.on('click', handler);
1674
+ */
1651
1675
  on<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, fn: (payload: EVENT_PAYLOAD[EVENT_NAME] extends {
1652
1676
  data: null;
1653
1677
  } ? EVENT_PAYLOAD[EVENT_NAME]['data'] : EVENT_PAYLOAD[EVENT_NAME]) => void): void;
1678
+ /**
1679
+ * Unsubscribe a function previously subscribed with {@link on}
1680
+ *
1681
+ * @param eventName An event name to which the provided function was previously
1682
+ * subscribed.
1683
+ * @param fn A function that was previously passed to {@link on}. The function must
1684
+ * have the same reference as the function that was subscribed.
1685
+ * @example
1686
+ * // Unsubscribe from the 'click' event
1687
+ * const handler = (event) => {
1688
+ * console.log('Map was clicked', event);
1689
+ * };
1690
+ * map.off('click', handler);
1691
+ */
1654
1692
  off<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, fn: (payload: EVENT_PAYLOAD[EVENT_NAME]) => void): void;
1655
1693
  /**
1656
1694
  * @private
1695
+ * @internal
1657
1696
  */
1658
1697
  destroy(): void;
1659
1698
  }