The above script imports the Embed module, creates a new embed instance with the given map ID, and mounts it on the target element. The result is a Boldmapper map being rendered at the target element when the page is loaded.
Options
The Embed instance can take the following parameters when being initialized:
Option
Description
Default
mapId
Required. The ID of the map you wish to render. This should be a UUID string and can be found on your map's Settings page.
N/A
onLoad
A callback function that is triggered when the embed and its map container are loaded.
null
onLocationSelect
A callback function that is triggered when a location is selected, either by click or via a search result. The callback function can take a "location" argument which contains some information about the selected location (e.g. name, address).
null
Methods
Embed instances have the following methods available to them:
mount()
Mounts the embed to the specified element. The argument can be either a DOM element or a CSS selector string (the first matching element will be used).
unmount()
Removes the embed from the page, restoring the mount element to it's pre-mount state. This can be useful when an explicit teardown is required (e.g. when rendering maps on pages with non-standard navigation handling, like Single Page Apps or Turbolinks).