# @oussamazaqouri/connection_checker

> **Overview:**

Latest version **1.1.1** (published 2023-11-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install @oussamazaqouri/connection_checker
pnpm add @oussamazaqouri/connection_checker
yarn add @oussamazaqouri/connection_checker
bun add @oussamazaqouri/connection_checker
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2023-11-12 |
| First published | 2023-11-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | oussamazaqouri |

## Links

- npm: https://www.npmjs.com/package/@oussamazaqouri/connection_checker
- Repository: https://github.com/zaqourioussama/connection_checker
- Homepage: https://github.com/zaqourioussama/connection_checker#readme
- Issues: https://github.com/zaqourioussama/connection_checker/issues
- npm.io page: https://npm.io/package/@oussamazaqouri/connection_checker

## Recent versions

- 1.1.1 (latest) — 2023-11-12
- 1.1.0 — 2023-11-11
- 1.0.0 — 2023-11-11

## README

# Network Status Check

**Overview:**

`connection_checker` is a lightweight JavaScript package designed to simplify the process of checking whether a browser is currently online or offline. It provides a single function, `checkNetworkStatus()`, that returns `true` if the browser is online and `false` if it's offline.

**Features:**

- **Easy integration:** Simply install the package using npm, import the `checkNetworkStatus` function, and start using it in your code.
  
- **Event handling:** The package includes event listeners for the browser's online and offline events, allowing you to respond dynamically to changes in network status.

**Usage Example:**

```javascript
const { checkNetworkStatus } = require('connection_checker');

// Function to handle online/offline events
function handleNetworkStatus() {
  if (checkNetworkStatus()) {
    console.log('Online');
    // Do something when online
  } else {
    console.log('Offline');
    // Do something when offline
  }
}

// Set up event listeners for online/offline events
window.addEventListener('online', handleNetworkStatus);
window.addEventListener('offline', handleNetworkStatus);

// Initial check when the application starts
handleNetworkStatus();

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