npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vue-internet-checker

v3.0.0

Published

Check internet availability in your Vue app

Downloads

607

Readme

vue-internet-checker

Vue 3 component/plugin to detect browser internet connectivity changes using native online and offline events.

  • Emits a boolean connectivity status.
  • Emits the original browser event object.
  • Lightweight component with no UI rendering.

Requirements

  • Vue 3.x
  • Browser environment (window and navigator)

Install

npm install vue-internet-checker
# or
yarn add vue-internet-checker
# or
pnpm add vue-internet-checker

CDN builds:

  • UNPKG: https://unpkg.com/vue-internet-checker/dist/
  • jsDelivr: https://cdn.jsdelivr.net/npm/vue-internet-checker/dist/

Usage

1) Global registration with plugin (app.use)

import { createApp } from 'vue';
import App from './App.vue';
import VueInternetChecker from 'vue-internet-checker';

const app = createApp(App);
app.use(VueInternetChecker);
app.mount('#app');

Then use in templates:

<vue-internet-checker @status="status" @event="event" />

2) Local registration in a component

<script>
import VueInternetChecker from 'vue-internet-checker';

export default {
  components: {
    VueInternetChecker,
  },
};
</script>

<template>
  <VueInternetChecker @status="status" @event="event" />
</template>

3) Named imports

import { vueInternetChecker } from 'vue-internet-checker';

TypeScript Support

This package includes built-in type declarations.

import VueInternetChecker, {
  vueInternetChecker,
  install,
  type InternetStatus,
  type InternetEvent,
} from 'vue-internet-checker';

Type details:

  • status event payload: InternetStatus (boolean)
  • event event payload: InternetEvent (Event)

TypeScript Example (<script setup lang="ts">)

<template>
  <VueInternetChecker @status="onStatus" @event="onEvent" />
  <p>Status: {{ isOnline ? 'Online' : 'Offline' }}</p>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import VueInternetChecker, {
  type InternetStatus,
  type InternetEvent,
} from 'vue-internet-checker';

const isOnline = ref<boolean>(true);

const onStatus = (value: InternetStatus): void => {
  isOnline.value = value;
};

const onEvent = (event: InternetEvent): void => {
  console.log(event.type);
};
</script>

Events

| Name | Payload | Description | | --- | --- | --- | | status | boolean | Current connectivity status. true when online, false when offline. | | event | Event | Native browser online/offline event object. |

Behavior Details

  • On mount, the component emits the initial status once (navigator.onLine).
  • On browser connectivity change, it emits:
    • status
    • event
  • On unmount, event listeners are removed.

Full Example

<template>
  <main>
    <VueInternetChecker @status="onStatus" @event="onEvent" />

    <h1>Internet Checker</h1>
    <p>Status: <strong>{{ isOnline ? 'Online' : 'Offline' }}</strong></p>
    <p>Last event: {{ lastEventType }}</p>
  </main>
</template>

<script>
import VueInternetChecker from 'vue-internet-checker';

export default {
  name: 'ConnectivityExample',
  components: {
    VueInternetChecker,
  },
  data() {
    return {
      isOnline: true,
      lastEventType: 'initial',
    };
  },
  methods: {
    onStatus(value) {
      this.isOnline = value;
    },
    onEvent(event) {
      this.lastEventType = event.type;
    },
  },
};
</script>

Vue 2 to Vue 3 Migration

Version 3.0.0 targets Vue 3.

  • Upgrade your app to Vue 3.
  • Register with createApp(...).use(...) for global use.
  • If you were using local component import, it still works.

Changelog

3.0.0

  • Added Vue 3 support.
  • Added plugin install API for app.use(...).
  • Added initial status emit on mount.
  • Added listener cleanup on unmount.
  • Updated build and package dependencies for Vue 3.

Contributing

  1. Fork the repo.
  2. Create your branch: git checkout -b my-feature.
  3. Commit your changes.
  4. Push the branch.
  5. Open a pull request.

License

MIT

Author

  • GitHub: https://github.com/harshmendapara
  • Email: [email protected]
  • LinkedIn: https://www.linkedin.com/in/harsh-mendapara-44883a165/