1.0.1 • Published 9 years ago

browser-location v1.0.1

Weekly downloads
38
License
MIT
Repository
github
Last release
9 years ago

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