Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created November 22, 2012 12:06
Show Gist options
  • Save brianleroux/4130820 to your computer and use it in GitHub Desktop.
Save brianleroux/4130820 to your computer and use it in GitHub Desktop.
network connection api example
var states = {}
states[navigator.connection.UNKNOWN] = 'Unknown connection'
states[navigator.connection.ETHERNET] = 'Ethernet connection'
states[navigator.connection.WIFI] = 'WiFi connection'
states[navigator.connection.CELL_2G] = 'Cell 2G connection'
states[navigator.connection.CELL_3G] = 'Cell 3G connection'
states[navigator.connection.CELL_4G] = 'Cell 4G connection'
states[navigator.connection.NONE] = 'No network connection'
console.log(states[navigator.connection.type])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment