General Interface is an open source project hosted by the Dojo Foundation

Load GMaps API V3

Load asynchronously the GMaps V3 API.
Contributed by Tony Lefebvre

loadGMaps
/**
 * Load asynchronously the GMaps V3 API\n
 * Usage:\n
 * <code>
 * loadGMaps(myApp.APP).when(function(rv) {
 * 	if (rv) {
 *	 	//gmaps loaded !
 *      jsx3.log('gmaps API loaded');
 *      //do something with the google.maps.* namespace
 *      //ie.: geocoder = new google.maps.Geocoder();
 * 	} 			
 * })
 * </code>
 * 
 * @param objServer (jsx3.app.Server) server namespace object
 * @return {jsx3.$AsyncRV} 
 */
loadGMaps = jsx3.$Y(function(cb) {
	var objServer = cb.args()[0]
	window._gmapscb = function() {
		cb.done(true)
	}
	objServer.loadInclude('http://maps.google.com/maps/api/js?sensor=true&callback=_gmapscb', 'gmaps', 'script', true)
})
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.