How can I keep the following asynchronous pattern DRY in JavaScript?
<p>The basic pattern is if X do something asynchronously else do something synchronously.  For example</p>

<pre><code>if (varNotSet) {
    setVarAsynchronously(function(callback) {
        // process callback then...
        render(page, {'var': myVar});
    });
}
else
    render(page, {'var': myVar});
</code></pre>

<p>What's bothering me is the following</p>

<pre><code>render(page, {var: myVar});
</code></pre>

<p>since the same code is repeated.  Is there some way that I can encapsulate that logic in a single place?</p>
