Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/excaliburhan/visibility-wrapper

A wrapper use for visilibity-js
https://github.com/excaliburhan/visibility-wrapper

visibility

Last synced: about 1 month ago
JSON representation

A wrapper use for visilibity-js

Awesome Lists containing this project

README

        

# visibility-wrapper
A wrapper use for visilibity-js

## Usage
```js
import { VisibilityChange, VisibilityStop } from 'visibility-wrapper'

VisibilityChange((state) => {
console.log(state)
})

// if browser do not support Visibility API, it will use Visibility.every from visivility-js, and return its timer id, don't forget to clear it when your page is destroyed

const id = VisibilityChange((state) => {
console.log(state)
})

// when page is destroyed
VisibilityStop(id)
```