universal-appstate
v0.7.0
Published
A universal appstate API.
Downloads
24
Keywords
Readme
universal-appstate
Obtain application becoming foreground or background
Supported
Installation
npm install --save universal-appstate
Usage
import AppState from 'universal-appstate';
console.log(AppState.isAvailable);
console.log(AppState.currentState); // active|background
const _handleAppStateChange = (nextAppState) => {
console.log(nextAppState); // active|background
}
AppState.addEventListener('change', _handleAppStateChange);
AppState.removeEventListener('change', _handleAppStateChange);
APIS
isAvailable: boolean
Whether to support.
nextAppState: 'active' | 'background'
Application becoming foreground or background.