Exposed Events
This section includes information about events related to the DAS Embed Map Component. It emits custom "save" and "error" events to notify app of key actions and errors within the component. You can set up listeners for these events to respond appropriately.
Save Event
The Save Event is triggered upon the successful completion of a saving operation. Use this event to process farm information within your application.
Event Data (SaveEvent):
{
// Total area of selected cadastres (in Ha).
'totalArea': number,
// Array containing the titles of selected cadastres.
'cadastres': {
'title': string
},
// Unique DAS identifier for the farm.
'dasFarmId': string,
// Unique identifier of the farm in embed, useful for connecting to other app data.
'embedFarmId': string,
// Name of the saved farm.
'farmName': string,
// Client identifier in your system (optional)
'clientId': string,
}
Example Usage
document.querySelector("#das-map").addEventListener("save", (event) ⇒ {
// event.detail.cadastres - {title: string}[]
// event.detail.totalArea - number (in Ha)
// event.detail.dasFarmId - string
});
Error Event
The Error Event is triggered when the embedFarmId doesn't match an existing DAS ID or any other error occurs within the DAS Embed Map Component. This allows you to log or handle errors as needed.
Event Data (ErrorEvent)
{
// Error code identifying the type of issue (e.g., "404", "500", "INVALID_INPUT").
'code': string
// Detailed error message.
'error': string
}
Example Usage
document.querySelector("#das-map").addEventListener("error", (event) ⇒ {
// error message - event.detail.error - string
// error code - event.detail.code - string
});
In summary, the DAS Embed Map Component’s events enables applications to handle successful saves and errors in a customized way. Attach event listeners to #das-map to process "save" and "error" events, allowing for seamless integration with your application’s workflows and error-handling logic.