0.0.0 • Published 6 years ago

down.js v0.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

down.js

Detects when the user connection goes down

Usage

ES6

import Down from 'down.js';

const down = new Down();

CDN

  <script src="link/to/down.js"></script>
  <script>
    const down = new Down();
  </script>

API

const down = new Down();

this.isOnline = !this.$down.isDown;
this.$down.on('online', () => {
  this.isOnline = true;
});

this.$down.on('offline', () => {
  this.isOnline = false;
});

Compatability

This library requires a polyfill for fetch.

MIT