Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

connection-state

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connection-state - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc