Skip to main content

onEvent

Last updated 8/06/2026

Event publishing handler

This example demonstrates how the

callback publishes a widget-generated event to a backend synchronization service using the Fetch API. The event is serialized and sent to the

/events
endpoint, where it can be distributed to other connected clients.

The host application does not need to interpret or modify the event contents and simply forwards the event contents and the event for processing by the synchronization infrastructure.

TypeScript
Event publishing handler
const onEvent = async function(event: DIQ_Event) => { 
fetch(`${apiBaseUrl}/events`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(event)
});
};