Pass the result to init()
or createMap()
.
Experimental
debounced[async] Returns an array of results or null
when a request is cancelled
or debounced. Cancellation happens when a new request is made before the
previous request completes. The Debounce wait time is 6ms and the function
is invoked with the last arguments provided.
Both cancelled and debounced requests will eventually resolve with an array of results (possibly empty).
Requests that throw an exception will return an empty array and output a warning message to the Web console.
Local/Nearby Search integration. If both refFloorID AND refPoint are provided, a second API call will be made and the results will be ordered where placemarks closest to the refPoint (x/y) will appear first.
Placemark Search defaults to a single instance per API. This should work fine for most use cases, but if you need to make multiple unique search calls simultaneously, each will need a unique API instance like shown below.
// Search Widget One API Instance.
const apiInstance1 = new MeridianSDK.API({
token: "<TOKEN GOES HERE>"
});
// Search Widget Two API Instance
const apiInstance2 = new MeridianSDK.API({
token: "<TOKEN GOES HERE>"
});
Readonly
environmentMeridian environment ("production"
or "eu"
). Defaults to
"production"
.
Readonly
languageLanguage code that matches a supported language for this location. Note: The LanguageCodes Type includes all possible language codes. See "Translations" in Meridian Editor to learn exactly what languages are supported for this location.
Readonly
tokenMeridian API token. Make sure to create a READ ONLY token for security. Otherwise anyone using your page could take your token and modify all of your Meridian data.
Use the fetch methods instead
[async] Returns an array of all floors at the specified location
[async] Returns an object URL for the given SVG URL
This object URL can be used as the src
for an img
tag.
This method fetches the SVG URL using your API token, since img
tags
can't pass API tokens. The SVG URL can be obtained from the svg_url
property on a floor. When you're finished using this URL, you should call
URL.revokeObjectURL
with the URL, so the browser can save memory by
releasing the data.
[async] Returns an Object with routes to the destination (endPlacemarkID)
Opens a tag stream for a given location and floor. onInitialTags
is
called with the full list of tags for that floor.
Note: When resourceType is set to "ZONE", onTagUpdate
is called when
a tag/resource exits or enters the zone. Otherwise, onTagUpdate
is
called every time a tag/resource is updated.
const api = new MeridianSDK.API({
token: token,
environment: "production"
});
const stream = api.openStream({
locationID: locationID,
floorID: floorID,
onInitialTags: (tags) => {
console.log("tags", tags);
},
onTagUpdate: (tag) => {
console.log("update", tag);
}
});
// Tag Zones
const stream = api.openStream({
locationID: locationID,
floorID: floorID,
resourceIDs: ["1218"],
resourceType: "ZONE",
onTagUpdate: (tag) => {
console.log("update", tag);
}
});
// call `stream.close()` when switching pages to avoid leaving the stream
// open and wasting bandwidth in the background
Holds an API token and environment. Can be used to access an
axios
instance for REST API calls, oropenStream()
for opening a tag stream. You can create multiple API instances in case you want to use multiple tokens (e.g. to show data from multiple locations or organizations on a single page).Example