Skip to content
On this page

Handling Events Emitted by the Widget

Widget also provide events to listen to in order to respond to specific state changes. These can be caught using the native event listeners, as shown below in JavaScript and TypeScript.

js
window.addEventListener('EVENT_NAME', (event) => {
    // Handle the event
    // Note that the sent information from the widget is found inside event.detail
});
ts
window.addEventListener('EVENT_NAME', ((event: CustomEvent) => {
    // Handle the event
    // Note that the sent information from the widget is found inside event.detail
}) as EventListener);

In these examples the value of EVENT_NAME needs to be replaced with the event values described in the events below.

Buy (F2C) events

Events emitted by the buy widget.

Sell (C2F) events

Events emitted by the sell widget.

Made with ❤ by BTC Direct