connection-state
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "connection-state", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Detect online and offline network state.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -13,2 +13,18 @@ # Connection state [![npm](https://img.shields.io/npm/v/connection-state.svg)](https://www.npmjs.com/package/connection-state) ![npm type definitions](https://img.shields.io/npm/types/connection-state.svg) | ||
## Usage | ||
```js | ||
import { connectionState } from 'connection-state' | ||
const connection = connectionState() | ||
console.log(`You are ${connection.getState()}.`) | ||
// connection.getState() returns 'online' or 'offline' | ||
connection.addListener((state) => { | ||
console.log(`Your connection state has changed. You are now ${state}.`) | ||
}) | ||
// state is 'online' or 'offline' | ||
``` | ||
## Development | ||
@@ -15,0 +31,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15874
33