项目作者: fluse

项目描述 :
listen to browser tab visibilitychange and get inactive time
高级语言: JavaScript
项目地址: git://github.com/fluse/react-tab-visibility.git
创建时间: 2016-06-20T07:15:16Z
项目社区:https://github.com/fluse/react-tab-visibility

开源协议:

下载


react-tab-visbility

supports react 15.x and 16.x

use react-tab-visibility for browser tab activity informations.

Get informed on tab change
Get time of inactivity after reactivation

Watch Demo

Install

  1. npm install react-tab-visibility --save

How to use

  1. import TabVisibility from 'react-tab-visibility'
  2. class YourComponent extends TabVisibility {
  3. onTabVisibilityChange({ isTabVisible, hiddenTime }) {
  4. this.setState({ isTabVisible })
  5. console.log(isTabVisible, hiddenTime)
  6. }
  7. }

Development

if you want to add or optimize this component, feel free <3

clone this repository and run install

  1. npm install

start dev server

  1. npm start

make your changes and build new es5 friendly version

  1. npm run build

Give me a coffee

Donate

get in touch?