Event listeners¶
Rumba JS API providers a listener pattern for the web application perform some callback once an event has been fired. As noted previously, the example below notifies the web application that the configuration’s settings have been modified
onSettingsChange event¶
// Omitted ...
rumba.addListener('onSettingsChange', (settings) => {
console.log('the settings have changed: ', settings);
// Update the UI with the new settings
// Decide whether to save the new settings inside the Rumba instance
});
// Omitted ...
onError event¶
Additionally, you may perform some custom action if an error occurs throughout the use of the Rumba JS API:
rumba.addListener('onError', (message) => {
displayAlert(message);
});