google-places-browser

1.0.0 • Public • Published

google-places-browser Build Status

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

google

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

google

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

Package Sidebar

Install

npm i google-places-browser

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker