JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 66831
  • Score
    100M100P100Q176904F
  • License MIT

Wrapper for asynchronously used Google Maps API

Package Exports

  • google-maps

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (google-maps) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NPM version Dependency Status Build Status

Donate

Google Maps

Wrapper for asynchronously used Google Maps API in browser.

This module does not change original google maps api in any way. It just provide easy way to load and use this API asynchronously.

Installation

Environment with common js:

$ npm install google-maps

Download and import one of these files into your .html file:

Usage

var GoogleMapsLoader = require('google-maps');		// only for common js environments

GoogleMapsLoader.load(function(google) {
    new google.maps.Map(el, options);
});

If you are not using environment with common js support, you can use GoogleMapsLoader variable directly. It is already in window object.

Options

Own API key

GoogleMapsLoader.KEY = 'qwertyuiopasdfghjklzxcvbnm';

Business API client

GoogleMapsLoader.CLIENT = 'yourclientkey';
GoogleMapsLoader.VERSION = '3.14';

Sensor

GoogleMapsLoader.SENSOR = true

Libraries

GoogleMapsLoader.LIBRARIES = ['geometry', 'places'];

Unload google api

For testing purposes is good to remove all google objects and restore loader to its original state.

GoogleMapsLoader.release(function() {
    console.log('No google maps api around');
});

Events

onLoad

GoogleMapsLoader.onLoad(function(google) {
    console.log('I just loaded google maps api');
});

Tests

$ npm test

Changelog list

  • 3.0.0

    • Register to bower registry
    • Moved to Carrooi organization
    • Using mocked loader, so tests are much faster
    • Optimized building request url
    • Some variables and methods are now private and not accessible from outside
    • Updated dependencies
    • Whole package is written in javascript, not coffeescript
  • 2.1.1

    • Sh**.... Forgot to increase version at package.json
  • 2.1.0

    • Added support for libraries #3 (thanks popara)
    • Added tests
    • Small optimization
  • 2.0.0

    • Added Maps API for Business support
    • Added standalone version for non common js environments
    • Removed dependency on q package
    • Using callback instead of promise
    • Added tests + travis
    • Added status badges
  • 1.0.0

    • Initial version