How to: Listen to and Act on App Events

Updated on 12. July 2022 by Jan Bunk

The app triggers a couple of events on certain occasions. In this guide we'll go over which events exist and how you can listen to them.


You can listen to the events like most other JavaScript events. Simply add an EventListener to the document element and the function will be triggered when the event occurrs.

    document.addEventListener("appPaused", function (e) {
        console.log("The app was paused!");

Available Event Types


Called when the user exits the app, e.g. by pressing the home button or turning off their device's screen.

Other causes that fire this event:


The opposite of appPaused. Called when the user comes back into the app, e.g. by re-opening it (after having closed it) or by unlocking their device.

Other causes that fire this event:


Fired when a custom tab gets closed. Check out our detailed guide all about why and how to open and close custom tabs here.