<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="https://mg.to" xmlns:dc="https://purl.org/dc/elements/1.1/">
<channel>
 <title>mg.to - Write the same code for Google Mapplets and Maps API - Comments</title>
 <link>https://mg.to/2007/06/22/write-the-same-code-for-google-mapplets-and-maps-api</link>
 <description>Comments for &quot;Write the same code for Google Mapplets and Maps API&quot;</description>
 <language>en</language>
<item>
 <title>Write the same code for Google Mapplets and Maps API</title>
 <link>https://mg.to/2007/06/22/write-the-same-code-for-google-mapplets-and-maps-api</link>
 <description>&lt;p&gt;&lt;a style=&quot;display:none;&quot; href=&quot;https://maps.google.com/ig/directory?synd=mpl&amp;amp;pid=mpl&amp;amp;features=sharedmap,geofeed&amp;amp;backlink=http%3A%2F%2Fmaps.google.com%2Fmaps%2Fmm%3Fmapprev%3D1%26ie%3DUTF8%26z%3D4%26om%3D1&amp;amp;num=24&amp;amp;url=https://www.zvents.com/widgets/mapplet/zmap.xml&quot; alt=&quot;Install the Zvents Mapplet&quot; title=&quot;Install the Zvents Mapplet&quot;&gt;&lt;img src=&quot;https://blog.zvents.com/assets/2007/6/12/mapplet.png&quot; style=&quot;width:300px; height:437px; border:none; float:right; margin:0 0 4px 8px;&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My last post introduced a new &lt;a href=&quot;https://mg.to/2007/06/06/a-fast-and-simple-async-api-for-google-mapplets&quot;&gt;GAsync API&lt;/a&gt; for &lt;a href=&quot;https://google-latlong.blogspot.com/2007/05/mashup-of-mashups.html&quot;&gt;Google Mapplets&lt;/a&gt;. I wrote that code to speed up the response time in our new &lt;a href=&quot;https://blog.zvents.com/2007/6/12/try-our-google-mapplet-and-speed-up-your-own&quot;&gt;Zvents mapplet&lt;/a&gt;. Try out our mapplet&amp;#8212;it&amp;#8217;s a fun way to &lt;a href=&quot;https://www.zvents.com/&quot;&gt;discover things to do&lt;/a&gt; in your area.&lt;/p&gt;

&lt;p&gt;Naturally, I was barely done with the mapplet when the thought came, &amp;#8220;Could we use this same code as a &lt;a href=&quot;https://www.google.com/apis/maps/&quot;&gt;Maps API&lt;/a&gt; application?&amp;#8221; The two APIs are mostly the same except for initialization&amp;#8212;and the pesky matter of the &lt;a href=&quot;https://www.google.com/apis/maps/documentation/mapplets/index.html#Asynchronous&quot;&gt;Async calls&lt;/a&gt;, e.g. &lt;code&gt;map.getCenterAsync()&lt;/code&gt; in the Mapplets API vs. &lt;code&gt;map.getCenter()&lt;/code&gt; in the Maps API. But having already written the &lt;code&gt;GAsync&lt;/code&gt; code, it turns out to be easy to make it work in both a mapplet and a Maps API app. The interface to &lt;code&gt;GAsync&lt;/code&gt; doesn&amp;#8217;t change at all from the previous version. The only difference is that the function now calls either the Async functions in a mapplet, or the non-Async functions in a Maps API app. And at the end of the function, for the Maps API it calls your callback function immediately&amp;#8212;there&amp;#8217;s no need to wait for any asynchronous calls.&lt;/p&gt;

&lt;p&gt;You still have to write code in the mapplet fashion, with a callback when you want to retrieve information from the map&amp;#8212;but now you can write code like this and run it identically in a mapplet or a Maps API app:&lt;/p&gt;

&lt;div style=&quot;padding: 5px !important; border: 1px solid rgb(253,187,134) !important; background-color: rgb(255,253,245) !important; font-family: Verdana,sans-serif !important;&quot;&gt;&lt;div style=&quot;background-color: rgb(255,250,238) !important;&quot;&gt;&lt;div class=&quot;geshi-javascript&quot;&gt;&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;GAsync&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; map, &lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;getSize&#039;&lt;/span&gt;, &lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;getBounds&#039;&lt;/span&gt;, &lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;getCenter&#039;&lt;/span&gt;,&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; size, bounds, center &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// search using size, bounds, and center&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Additional code samples are in &lt;a href=&quot;https://mg.to/2007/06/06/a-fast-and-simple-async-api-for-google-mapplets&quot;&gt;the original article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here is a &lt;a href=&quot;https://mg.to/mapplet/async/async.html&quot;&gt;demo page&lt;/a&gt; running the &lt;a href=&quot;https://maps.google.com/ig/directory?synd=mpl&amp;amp;pid=mpl&amp;amp;features=sharedmap%2Cgeofeed&amp;amp;backlink=http%3A%2F%2Fmaps.google.com%2Fmaps%2Fmm%3Fmapprev%3D1%26ie%3DUTF8%26z%3D4%26om%3D1&amp;amp;num=24&amp;amp;url=https://mg.to/mapplet/async/async.xml&quot;&gt;test mapplet&lt;/a&gt; from the previous article as a Maps API app.&lt;/p&gt;

&lt;p&gt;And here is the updated GAsync code. First, a &lt;a href=&quot;https://mg.to/mapplet/async/async.js&quot;&gt;compact version&lt;/a&gt; ready to copy into your mapplet + Maps API code:&lt;/p&gt;

&lt;div style=&quot;padding: 5px !important; border: 1px solid rgb(253,187,134) !important; background-color: rgb(255,253,245) !important; font-family: Verdana,sans-serif !important;&quot;&gt;&lt;div style=&quot;background-color: rgb(255,250,238) !important;&quot;&gt;&lt;div class=&quot;geshi-javascript&quot;&gt;&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// GAsync v2 by Michael Geary&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Commented version and description at:&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// https://mg.to/2007/06/22/write-the-same-code-for-google-mapplets-and-maps-api&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Free beer and free speech license. Enjoy!&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt; GAsync&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; obj &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt; callback&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; args&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;nArgs&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;null&lt;/span&gt;, results &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt; queue&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; iResult, &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;, next &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt; ready&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; value &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; results&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;iResult&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt; = value;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; ! --nCalls &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; callback&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; a = &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; next.&lt;span style=&quot;color: #006600;&quot;&gt;join&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a = a.&lt;span style=&quot;color: #006600;&quot;&gt;concat&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt;next&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;, ++iArg;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; mapplet &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a.&lt;span style=&quot;color: #006600;&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; ready &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; obj&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;+&lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;Async&#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; obj, a &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; results&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;iResult&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt; = obj&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; obj, a &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; mapplet = ! window.&lt;span style=&quot;color: #006600;&quot;&gt;GBrowserIsCompatible&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; args = arguments, nArgs = args.&lt;span style=&quot;color: #006600;&quot;&gt;length&lt;/span&gt; - &lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; results = &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;, nCalls = &lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iArg = &lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;;&amp;nbsp; iArg &amp;lt; nArgs;&amp;nbsp; ++iArg &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt; = args&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;iArg&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #C00000;&quot;&gt;typeof&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt; == &lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;object&#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; obj = &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; queue&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; nCalls++, &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;, args&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;iArg+&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; ! mapplet &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; callback&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And a commented version:&lt;/p&gt;

&lt;div style=&quot;padding: 5px !important; border: 1px solid rgb(253,187,134) !important; background-color: rgb(255,253,245) !important; font-family: Verdana,sans-serif !important;&quot;&gt;&lt;div style=&quot;background-color: rgb(255,250,238) !important;&quot;&gt;&lt;div class=&quot;geshi-javascript&quot;&gt;&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// GAsync v2 by Michael Geary&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// https://mg.to/2007/06/22/write-the-same-code-for-google-mapplets-and-maps-api&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Free beer and free speech license. Enjoy!&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;//&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Call one or more xyzAsync() functions from the Google&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Mapplet API, with a single callback that receives the&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// values from all of the called functions. The first argument&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// to GAsync is the object to be used. The next arguments&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// are each of the function names, without the &#039;Async&#039;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// suffix. The last argument is the callback function.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// To call xyzAsync() functions for more than one object,&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// list another object in the argument list and the function&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// names after that will use that object.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// To call an xyzAsync() function that takes arguments of&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// its own (other than the callback argument), place an&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// array of those arguments after the function name in&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// GAsync&#039;s argument list.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Example calls, given existing map and marker objects&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;/*&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; // Get the size, bounds, and center of the map&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; GAsync( map, &#039;getSize&#039;, &#039;getBounds&#039;, &#039;getCenter&#039;,&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function( size, bounds, center ) {&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // ...&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; // Get the zoom level, size, bounds, and center for&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; // the map, as well as the lat/long of the top left&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; // corner of the map. Also get the point and icon&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; // for marker.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; GAsync(&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map, &#039;getZoom&#039;, &#039;getSize&#039;, &#039;getBounds&#039;, &#039;getCenter&#039;,&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#039;fromContainerPixelToLatLng&#039;, [ new GPoint(0,0) ],&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; marker, &#039;getPoint&#039;, &#039;getIcon&#039;,&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function( zoom, size, bounds, center, topleft, point, icon ) {&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // ...&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; // Equivalent code using nested xyzAsync calls:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; map.getSizeAsync( function( size ) {&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.getBoundsAsync( function( bounds ) {&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.getCenterAsync( function( center ) {&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // ...&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; map.getZoomAsync( function( zoom ) {&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.getSizeAsync( function( size ) {&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.getBoundsAsync( function( bounds ) {&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.getCenterAsync( function( center ) {&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.fromContainerPixelToLatLngAsync( new GPoint(0,0), function( topleft ) {&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; marker.getPointAsync( function( point ) {&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; marker.getIconAsync( function( icon ) {&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // ...&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;&amp;nbsp; &amp;nbsp; });&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;*/&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt; GAsync&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; obj &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Call the callback function provided in the GAsync() call&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt; callback&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; args&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;nArgs&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;null&lt;/span&gt;, results &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Queue a single xyzAsync() function call.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// &#039;iResult&#039; is the index into the final results array.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// &#039;name&#039; is the name of the Maps API function without&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// the Async suffix.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// &#039;next&#039; is the next argument to GAsync following name;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// If next is an array, it contains the arguments to be&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// passed to xyzAsync().&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt; queue&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; iResult, &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;, next &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Callback for the xyzAsync() function that was called&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// by this invocation of the queue() function.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// value is the return value from the Maps API.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;function&lt;/span&gt; ready&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; value &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Save the result in the final results array&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; results&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;iResult&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt; = value;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// If every async function has completed, call the&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// GAsync callback (in the last argument to GAsync)&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// with the final results array as its arguments.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; ! --nCalls &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; callback&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Arguments array for the xyzAsync() call&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; a = &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// If &#039;next&#039; is an array, it contains arguments to&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// be passed to xyzAsync()&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; next.&lt;span style=&quot;color: #006600;&quot;&gt;join&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;&amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Arrays have .join, strings do not&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a = a.&lt;span style=&quot;color: #006600;&quot;&gt;concat&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt;next&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;, ++iArg;&amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// append and skip&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Call xyzAsync() in a mapplet or xyz() in the Maps API&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; mapplet &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// The callback for xyzAsync is its last argument&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a.&lt;span style=&quot;color: #006600;&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; ready &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Call xyzAsync() with arguments in &#039;a&#039;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; obj&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;+&lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;Async&#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; obj, a &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Maps API, call xyz() and save its return value&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; results&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;iResult&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt; = obj&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #006600;&quot;&gt;apply&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; obj, a &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Is this is a mapplet or the Maps API?&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; mapplet = ! window.&lt;span style=&quot;color: #006600;&quot;&gt;GBrowserIsCompatible&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// &#039;args&#039; is a reference to GAsync&#039;s arguments array&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// that can be used in the nested functions.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// &#039;nArgs&#039; is is the number of arguments, not counting&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// the callback function at the end. (Thus, args[nArgs]&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// is a reference to the callback function.)&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; args = arguments, nArgs = args.&lt;span style=&quot;color: #006600;&quot;&gt;length&lt;/span&gt; - &lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// &#039;results&#039; is the final results array for the callback. It&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// will be populated from the individual ready() callbacks.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// &#039;nCalls&#039; is the total number of xyzAsync() calls. It is&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// incremented as those calls are queued, and then&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// decremented to discover when all the calls are done.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; results = &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;, nCalls = &lt;span style=&quot;color: #CC0000;&quot;&gt;0&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Loop through GAsync()&#039;s arguments, starting at&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// the first function name (after &#039;obj&#039;), and ending&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// before the callback function.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; iArg = &lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;;&amp;nbsp; iArg &amp;lt; nArgs;&amp;nbsp; ++iArg &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// Get the name of the function to be called&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #003366; font-weight: bold;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt; = args&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;iArg&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// If the argument is an object, not a name,&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// switch to that object for subsequent calls.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// If it is a name, count and queue the function.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #C00000;&quot;&gt;typeof&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt; == &lt;span style=&quot;color: #3366CC;&quot;&gt;&#039;object&#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; obj = &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;;&amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// change object&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;else&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; queue&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; nCalls++, &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;, args&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#91;&lt;/span&gt;iArg+&lt;span style=&quot;color: #CC0000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900; font-style: italic;&quot;&gt;// If using the Maps API, call the callback now&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #C00000;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt; ! mapplet &lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; callback&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;
&lt;div style=&quot;background-color:rgb(255,234,216);&quot;&gt;&lt;span style=&quot;color: #66cc66;color: #0000FF;&quot;&gt;&amp;#125;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As the code says, enjoy!&lt;/p&gt;
</description>
 <comments>https://mg.to/2007/06/22/write-the-same-code-for-google-mapplets-and-maps-api#comments</comments>
 <category domain="https://mg.to/topics/programming/javascript">JavaScript</category>
 <pubDate>Fri, 22 Jun 2007 01:18:42 +0000</pubDate>
 <dc:creator>Michael Geary</dc:creator>
 <guid isPermaLink="false">177 at https://mg.to</guid>
</item>
</channel>
</rss>
