Skip to content

Lifecycle events

Listen for the page entering the foreground event.

const unsubscribe = SuperSDK.onForeground((data) => {
console.log('Entered foreground', data.triggerFrom);
// triggerFrom: 'window' | 'view' | 'activity'
});
// Cancel listener
unsubscribe();

triggerFrom Description:

ValueDescription
windowWindow visibility change (e.g., switching back from another app)
viewView visibility changes (e.g., tab switching)
activityActivity lifecycle change (onResume)

Listen for the page entering the background event.

const unsubscribe = SuperSDK.onBackground((data) => {
console.log('Entered background', data.triggerFrom);
});