JavaScript synchronise multiple function calls
<p>I have a document, which has two <code>javascript</code> functions <code>A();</code> and <code>B();</code>.The functions get called in no  particual order, I want to do something upon the last call.</p>

<p>I can accomplish the task by using local variables, but before doing so I'd like to confirm if there's more elegant/robust way for doing that - I might have more than two such fucntions, which makes local vars solution a complete mess.</p>

<p>Update 1 - More details</p>

<p>I've a few SilverLight plugins on a page, each has </p>

<pre><code>&lt;param name="onLoad" value="pluginLoaded" /&gt;
</code></pre>

<p>I can't go any further than "pluginLoaded" no paramters no nothing.</p>

<p>The plugins get loaded in an absolute random order, upon the overall compeltion I want to call another function. </p>
