Steven Olmsted![]()
Google Maps Loader is a JSONP wrapper for loading the Google Maps Javascript API. It provides a simple interface for loading extra libraries, localization, and versioning.
This module has recently been updated with API changes. Y.GoogleMapsLoader is now a regular class extending Base instead of a singleton instance.
Y.GoogleMapsLoader has two public attributes.
source: the location of the Google Maps Javascript API. Defaults to 'http://maps.google.com/maps/api/js'
timeout: the timeout used by JSONP. Defaults to 30 seconds.
Y.GoogleMapsLoader has three public events.
failure: fired when JSONP fails to load the Google Maps Javascript API.
success: fireOnce: fired when the Google Maps Javascript API is loaded.
timeout: fired when JSONP times out.
Y.GoogleMapsLoader has two public methods.
isLoaded: returns boolean.
load: loads the Google Maps Javascript API. (Does nothing if already loaded.)
The load method accepts an optional parameters object. The parameters object may include any of these optional members.
client: This is your client id when using Google Maps API for Business
key: This is your Google Maps v3 API key.
language: the language code to override the browser's default language.
libraries: an array or comma separated list of library names.
region: a Unicode region subtag identifier to override the default region.
sensor: set this to true if your application determines the user's location via a sensor .
source: location of the Google Maps Javascript API to override the attribute.
timeout: timeout in milliseconds to override the attribute.
version: the version of the Google Maps Javascript API to load.
<script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2012.09.05-20-01'
}).use('gallery-google-maps-loader', 'node', function (Y) {
new Y.GoogleMapsLoader().load({
language: 'ja',
libraries: [
'adsense',
'geometry'
],
region: 'ES',
sensor: false,
version: '3.4'
}).on('success', function () {
new google.maps.Map(Y.Node.getDOMNode(Y.one('#map')), {
zoom: 1,
center: new google.maps.LatLng(0, 0),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
});
});No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info