Class

Scheduler

Scheduler(checkInterval, checkSession, onSessionExpired)

Manages scheduling for periodic and timeout-based session checks.
Constructor

# new Scheduler(checkInterval, checkSession, onSessionExpired)

Parameters:
Name Type Description
checkInterval number The interval in milliseconds between periodic session checks.
checkSession SessionCheckCallback The callback function to perform a session check.
onSessionExpired SessionExpiredCallback The callback function to handle session timeout events.

View Source lib/events/Scheduler.ts, line 11

Classes

Scheduler

Methods

# calcTimeToNextCheck(lastCheck) → {number}

Calculates the time until the next session check should occur.
Parameters:
Name Type Description
lastCheck number The timestamp (in milliseconds) of the last session check.

View Source lib/events/Scheduler.ts, line 177

The time in milliseconds until the next check should be performed.
number

# isRunning() → {boolean}

Checks if the scheduler is currently running.

View Source lib/events/Scheduler.ts, line 162

True if the scheduler is running; otherwise, false.
boolean

# scheduleSessionExpiry(timeToExpiration) → {void}

Handles the session expiration when it is about to expire soon. Stops any ongoing checks and schedules a timeout for the expiration.
Parameters:
Name Type Description
timeToExpiration number The time in milliseconds until the session expires.

View Source lib/events/Scheduler.ts, line 139

void

# sessionExpiresSoon(expiration) → {boolean}

Checks if the session is about to expire.
Parameters:
Name Type Description
expiration number Timestamp when the session will expire.

View Source lib/events/Scheduler.ts, line 169

True if the session is about to expire; otherwise, false.
boolean

# start(lastCheck, expiration) → {void}

Starts the session check process. Determines when the next check should run based on the last known check time and session expiration. If the session is expiring soon, schedules an expiration event instead of starting periodic checks.
Parameters:
Name Type Description
lastCheck number The timestamp (in milliseconds) of the last session check.
expiration number The timestamp (in milliseconds) of when the session expires.

View Source lib/events/Scheduler.ts, line 150

void

# stop() → {void}

Stops the session check process and clears all timers.

View Source lib/events/Scheduler.ts, line 156

void