# @js-factory/visibility

> Page Visibility API Implementation for single page applications

Latest version **0.2.0** (published 2020-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @js-factory/visibility
pnpm add @js-factory/visibility
yarn add @js-factory/visibility
bun add @js-factory/visibility
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-08-12 |
| First published | 2020-05-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | parveen.arora, upendradevsingh |
| Keywords | javascript, spa |

## Links

- npm: https://www.npmjs.com/package/@js-factory/visibility
- Repository: https://github.com/js-factory/visibility
- Homepage: https://github.com/js-factory/visibility#readme
- Issues: https://github.com/js-factory/visibility/issues
- npm.io page: https://npm.io/package/@js-factory/visibility

## Dependencies (1)

- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.20.2

## Recent versions

- 0.2.0 (latest) — 2020-08-12
- 0.1.0 (beta) — 2020-05-12

## README

# visibility

Page Visibility API implementation

## Installation

```
npm i -S @js-factory/visibility
```

## Usage

```js
import onVisibilityChange from '@js-factory/visibility';
import { h, Component } from 'preact';

export default class AppWrapper extends Component{

    ...
    ...

    componentDidMount(){
        onVisibilityChange();
    }
}

```

## API

##### onVisibilityChange(options, handler);

- _options_
  -- refreshTime - this is used to decide when to refresh the window when visiblity changes. DEFAULT_VALUE: 120000 ms
  -- scrollToTop - Set browser scroll position to (0,0). DEFAULT_VALUE: true 

- _handler_ custom handler function to be executed when visibility of page is changes

---
_Source: https://npm.io/package/@js-factory/visibility · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
