google-places-browser
v1.0.0
Published
Google place API client for the browser
Downloads
14
Maintainers
Readme
google-places-browser
Google place API client for the browser
Install
$ npm install --save google-places-browser
Usage
var Autocomplete = require('google-places-browser/autocomplete')
var Places = require('google-places-browser/places')
var autocomplete = Autocomplete(window.google)
var places = Places(window.google)
autocomplete.places({input: 'San Francisco'}, function (err, results) {
//=> handle err/result array
})
places.details({placeId: 'id'}, function (err, place) {
//=> handle err/place
})
API
All API methods wrap Google's callback in Node-style (err, args...
) errbacks. Errors have a code
property that exposes the the returned service status.
Places(google)
-> object
Required
Type: object
The Google Maps JS API.
Returns an alternate place API with the following methods that wrap the PlacesService
class:
- details
- nearby
- radar
- text
Autocomplete(google)
-> object
Required
Type: object
The Google Maps JS API.
Returns an alternate autocomplete API with the following methods that wrap the AutocompleteService
class:
- place
- query
License
MIT © Ben Drucker