Class Mappedin

Hierarchy

Constructors

  • Parameters

    • options: TGetVenueOptionsInternal<TAllGetVenueOptions>

    Returns Mappedin

    Deprecated

    Use hydrateVenue instead

Properties

analytics: IAnalytics
categories: MappedinCategory[]
changeLanguage: ((languageCode, cache?) => Promise<void>)

Type declaration

    • (languageCode, cache?): Promise<void>
    • Change the language of the venue. This will trigger a re-fetch of the venue data and emit a {GET_VENUE_EVENT.LANGUAGE_CHANGED} event.

      Parameters

      • languageCode: string

        The language code to change to

      • Optional cache: boolean

        Whether or not to cache the current language so it doesn't need to be re-fetched

      Returns Promise<void>

currentLanguage: {
    code: string;
    name: string;
}

Type declaration

  • code: string
  • name: string
events: MappedinEvent[]
hydrate: ((mappedinSerializableData, shouldPopulateBundledImagesAsBlobs?, updateInPlace?) => Promise<undefined>)

Type declaration

    • (mappedinSerializableData, shouldPopulateBundledImagesAsBlobs?, updateInPlace?): Promise<undefined>
    • Experimental

      Hydrate the Mappedin instance using a response from either Mappedin.toString, getVenueBundle or by downloading the bundle manually

      Parameters

      • mappedinSerializableData: string | Record<string, unknown>

        Mappedin data that was serialized or exported as JSON

      • Optional shouldPopulateBundledImagesAsBlobs: boolean

        Takes the scenes and images from a bundle and maps them as blobs to where they exist as URLs in the bundle. False by default

      • Optional updateInPlace: boolean

      Returns Promise<undefined>

imageBinaries?: Map<string, Uint8Array>
images: any
locationStates: MappedinLocationState[]
locations: MappedinLocation[]
mapGroups: MappedinMapGroup[]
maps: MappedinMap[]
nodes: MappedinNode[]
options: any
perspective: any
polygons: MappedinPolygon[]
rankings?: MappedinRankings
scenes: any
themes: MappedinTheme[]
things: any
toJSON: ((includeOptions?) => any)

Type declaration

    • (includeOptions?): any
    • Export venue data to JSON (for storage, encryption, etc)

      Parameters

      • Optional includeOptions: boolean

      Returns any

toString: ((includeOptions?) => string)

Type declaration

    • (includeOptions?): string
    • Export venue data to String

      Parameters

      • Optional includeOptions: boolean

      Returns string

updatedAt?: string
vortexes: MappedinVortex[]

Methods

  • Parameters

    • Optional updateInPlace: boolean

    Returns Promise<void>

  • Type Parameters

    Parameters

    • name: T
    • id: I

    Returns null | TAccessors[T]

  • Unsubscribe a function previously subscribed with on

    Type Parameters

    Parameters

    • eventName: EVENT_NAME

      An event name to which the provided function was previously subscribed.

    • fn: ((payload) => void)

      A function that was previously passed to on. The function must have the same reference as the function that was subscribed.

        • (payload): void
        • Parameters

          • payload: GET_VENUE_PAYLOAD[EVENT_NAME]

          Returns void

    Returns void

    Example

    // Unsubscribe from the 'click' event
    const handler = (event) => {
    console.log('Map was clicked', event);
    };
    map.off('click', handler);
  • Subscribe a function to an event.

    Type Parameters

    Parameters

    • eventName: EVENT_NAME

      An event name which, when fired, will call the provided function.

    • fn: ((payload) => void)

      A callback that gets called when the corresponding event is fired. The callback will get passed an argument with a type that's one of event payloads.

        • (payload): void
        • Parameters

          • payload: GET_VENUE_PAYLOAD[EVENT_NAME] extends {
                    data: null;
                }
                ? any[any]["data"]
                : GET_VENUE_PAYLOAD[EVENT_NAME]

          Returns void

    Returns void

    Example

    // Subscribe to the 'click' event
    const handler = (event) => {
    const { coordinate } = event;
    const { latitude, longitude } = coordinate;
    console.log(`Map was clicked at ${latitude}, ${longitude}`);
    };
    map.on('click', handler);