Events

The app will sometimes call the website. Events are used for this kind of communication.

General

Events, called from the app, has no return value as those are calls from the app to the website and the website isn’t supposed to return anything back to the app.

Example:

var PushNotification = {
    notificationReceivedEvent(arguments) {
        console.log('Notification received: ' + JSON.stringify(arguments));
    }
}

Scopeless events

There are two scopeless events in the system. Those doesn’t belong to an integration but are system events.

appIntegrationsAreReady()

This event is fired when all integrations in the app are loaded correctly and the integrations are ready to be called. The website shouldn’t call webAppIsReady() before this event has been fired.

In normal circumstances it shouldn’t be necessary to listen for this event as the app should be loaded and ready a lot faster than the website, which has to be loaded from an external server. But if the call to webAppIsReady() fails it’s probably because the app has completed its initialization process yet.

appErrorEvent(error): { message: string: AdditionalDetails: string }

If an error occurs in the app in relation to a call from the website to the app, the exception will be caught and transferred to the website through this event.