Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

connectivity

feross13.2kMIT1.0.2

Detect if the network is up (do we have connectivity?)

online, offline, detect, network, up, down, connected, ping, on-line, off-line, connectivity, mad science

readme

connectivity travis npm downloads javascript style guide

Detect if the network is up (do we have connectivity?)

internet!

The module answers the most important question: is the cat-picture delivery system working?

usage

var connectivity = require('connectivity')

connectivity(function (online) {
  if (online) {
    console.log('connected to the internet!')
  } else {
    console.error('sorry, not connected!')
  }
})

Also works in the browser with browserify!

license

MIT. Copyright Feross Aboukhadijeh.