Integration API:
Check the code example at the bottom of the site, for a code example.
Read more detailed information in the referenced API documentation:
OnMapLoaded API referencecheckIntegrationAPI API reference
To use the function as seen in the example, use following code:
function postEvent(functionName, detail) {
const integrationElement = document.getElementById('mapIntegrationElement').contentWindow
if(integrationElement){
integrationElement.postMessage({functionName: functionName, detail: detail}, "*")
}
}
[...]
// use this code at the start of your script to get the first initialisation signal of the integrationAPI.
// This will be send once at the start up of the integrationAPI, even if the map is still not available.
// this code can also be used to check the integrationAPI availability with the "postEvent("checkIntegrationAPI",{})" Request.
window.addEventListener(
"message",
(evt) => {
if(evt.data.functionName === "integrationApiReady"){
// integrationAPI is initialised and can receive requests, even if the map is not fully loaded
yourStartRoutine()
}
},
false
);
[...]
const parameter = {
name: "zoomTo",
parameter: {
geometry: {
type: "point",
x: 405647.97489873506,
y: 5662584.6720447205,
spatialReference: {
wkid: 25833
}
},
scale: 50000
}
}
postEvent("onMapLoaded",parameter )
[...]
// test if the integration API is already initialised
postEvent("checkIntegrationAPI",{} )