Skip to content

clehner/nm-state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 

Repository files navigation

nm-state

Get the state of NetworkManager. Get notifications when the state changes, i.e. when your computer gets connected and disconnected from the Internet.

Usage

npm install nm-state
var nmState = require('nm-state')
nmState(function (state) {
  if (state >= nmState.CONNECTED_SITE ) {
    console.log('probably connected to the internet.')
  } else {
    console.log('probably not connected to the internet.')
  }
})

Code and state may be one of the following:

0: 'unknown'
10: 'asleep'
20: 'disconnected'
30: 'disconnecting'
40: 'connecting'
50: 'connected_local'
60: 'connected_site'
70: 'connected_global'

License

GPLv3+

About

npm module for detecting changes in NetworkManager state

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published