1.0.4 • Published 3 years ago

is-page-active v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

is-page-active

This is a tool to detect if the current page is active, and it provides a listener and a function which can detect directly.

Getting Started

Just follow these steps below.

Installing

yarn

yarn add is-page-active

npm

npm install is-page-active --save

Examples

detect if the browser support this feature

import { isSupported } from  "is-page-active";
console.log(isSupported());
// true

detect if the current page is active directly

import { isActive } from  "is-page-active";
console.log(isActive());
// true

add a listener to do something when the active status changes

import { onActiveChange } from  "is-page-active";
onActiveChange((active) => {
	if(active) {
		console.log("The page is active now")
	} else {
		console.log("The page is inactive now")
	}
})

License

This project is licensed under the MIT License - see the LICENSE.md file for details

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago