Skip to main content

# subscribeToSessionExpiryWarning()

    function subscribeToSessionExpiryWarning(onSessionExpiryWarn: WARNLISTENER): (...args: []) => void;

Subscribes to session expiry warning events. The callback is invoked when the session is about to expire (based on warning interval).

## Parameters​

### onSessionExpiryWarn​

`WARNLISTENER`

Callback function that receives the warning timestamp

## Returns​

Unsubscribe function to remove the listener

    (...args: []): void;

### Parameters​

#### args​

...[]

### Returns​

`void`

## Example​

    const unsubscribe = subscribeToSessionExpiryWarning((warningTime) => {
      console.log('Session expiring at:', warningTime);
      showWarningModal();
    });

    // Later, to unsubscribe
    unsubscribe();