Skip to content

isTabActive ​

The isTabActive function checks if the browser tab is active (visible to the user).

Syntax ​

typescript
isTabActive(): boolean;

Parameters ​

NameTypeDescription
––This function does not take any parameters

Returns ​

NameTypeDescription
–booleantrue if the tab is visible

Examples ​

typescript
isTabActive();
// => true

Notes ​

  • Useful for pausing or resuming tasks based on tab visibility.

References ​

Released under the MIT License.