Lifecycle events
onForeground(callback)
Section titled “onForeground(callback)”Listen for the page entering the foreground event.
const unsubscribe = SuperSDK.onForeground((data) => { console.log('Entered foreground', data.triggerFrom); // triggerFrom: 'window' | 'view' | 'activity'});
// Cancel listenerunsubscribe();triggerFrom Description:
| Value | Description |
|---|---|
| window | Window visibility change (e.g., switching back from another app) |
| view | View visibility changes (e.g., tab switching) |
| activity | Activity lifecycle change (onResume) |
onBackground(callback)
Section titled “onBackground(callback)”Listen for the page entering the background event.
const unsubscribe = SuperSDK.onBackground((data) => { console.log('Entered background', data.triggerFrom);});