Events
Apart from properties, the Axitech Widget also provides events that allow you to seamlessly handle different stages of the widget's lifecycle.
| Event | Description |
|---|---|
| onSuccess | Executes after a claim submission is successfully processed. Provides the submitted data object as a parameter. |
| onError | Executes when an error occurs during the claim submission process. Provides an API error as a parameter. |
| onChange | Executes when the claim data changes. Provides the updated claim data object as a parameter. |
Event Details
onSuccess Event
The onSuccess function is invoked after a claim submission is successfully processed. It provides information related to the submitted claim, including the submission date. You can use this function to perform custom actions or display confirmation messages upon successful claim submission.
Example Usage
widget.load('API-KEY', {
// ... other configuration properties
onSuccess: function (submissionDate) {
// Handle success, e.g., display a success message or perform custom actions.
console.log('Claim submitted successfully on:', submissionDate);
},
});
onError Event
The onError function is executed when an error occurs during the claim submission process. It provides a custom error message that can help you identify and handle the issue gracefully. You can use this function to display error messages or log error details for further investigation.
Example Usage
widget.load('API-KEY', {
// ... other configuration properties
onError: function (errorMessage) {
// Handle error, e.g., display an error message or log error details.
console.error('Claim submission error:', errorMessage);
},
});
onChange Event
The onChange event is triggered whenever any data within the widget is changed. It provides information about the specific data that was changed, allowing you to react to data modifications in real-time.
Example Usage:
widget.load('API-KEY', {
// ... other configuration properties
onChange: function (changedData) {
// React to data changes as needed
console.log('Widget data changed:', changedData);
},
});