browser-location

1.0.1 • Public • Published

browser-location Build Status

Geolocation for the browser with a Node-friendly API

Install

$ npm install --save browser-location

Usage

var location = require('browser-location')
 
location.get(function (err, position) {
  //=> null, {coords: {...}, timestamp: ...}  
})

API

location.get([options], callback) -> undefined

options

Type: object
Default: {}

A PositionsOptions object that will be passed to the geolocation API.

callback

Required
Type: function Arguments: err, position

A callback that will be called with an error or a Position object. The error will be a GeolocationNotSupported error if geolocation is not supported. Otherwise it will be a PositionError.

location.GeolocationNotSupportedError(message) -> error

The constructor for the error that is returned in browsers that do not support geolocation. Exposed as a convenience so your code can distinguish between error states.

message

Type: string
Default: 'Geolocation is not supported'

License

MIT © Ben Drucker

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    6
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    6
  • 1.0.0
    0

Package Sidebar

Install

npm i browser-location

Weekly Downloads

6

Version

1.0.1

License

MIT

Last publish

Collaborators

  • bendrucker