New utility function for Google Mapplets: GAsync()

Thursday, July 26, 2007 at 5:53:00 PM

The Mapplets API is like the Maps API with a twist: asynchronous calls. If you've ever used XMLHttpRequest then you've dealt with asynchronous calls before, but writing fast Mapplets can require keeping track of several requests at the same time.

While working on the Zvents mapplet, Michael Geary developed a nifty utility function called GAsync(). This lets you make several requests in a single call, like:

GAsync( map, 'getSize', 'getBounds', 'getCenter',
 function( size, bounds, center ) {
   // search using size, bounds, and center
 });

Mike has kindly donated this function to the Mapplets API so that everyone can use it. We hope that it helps you write fast and simple code for your Mapplets!

For more information on the creation and use of GAsync, check out Mike's blog post about it. The Mapplets API docs and forum will help you get started on your own Mapplet.