Widget display methods
After creating and configuring the widget, you can use a few methods to control the widget's display.
Please make sure you use the latest version of SDK (6.x.x).
You can use the following widget class methods:
Method | Description |
---|---|
open | Mount the widget in the DOM and make it visible. |
close | Close the widget modal. |
updateTheme | Switch the widget's theme without reloading it. |
addEventListeners | Add event listeners. You can find more info on the event listeners in the listeners object page. |
removeEventListeners | Remove event listeners. |
The open()
method will initialize the widget as an iFrame.
wertWidget.open();
You can switch the widget's theme without reloading it; please note this method should be called only after the widget is fully loaded:
wertWidget.updateTheme({
theme: 'dark', // Use 'undefined' for the default light theme.
colors: {
// Can be in any suitable format (string, HEX, rgb etc.)
color_buttons: 'red',
},
});
You can listen to widget events:
wertWidget.addEventListeners({
position: data => console.log('step:', data.step),
});
Here are the options to remove event listeners:
wertWidget.removeEventListeners('rate-update');
//or
wertWidget.removeEventListeners([ 'rate-update', 'payment-status' ]);
//or
wertWidget.removeEventListeners();
Updated 8 months ago
Documentation related to this page