title: How can I block until Dojo Deferred is resolved?
body: <p>I know the recommended use case for Dojo Deferreds is to use dojo.when(def) or def.then() and provide a callback for when the Deferred is resolved. However, sometimes I run into scenarious where I really need to wait for that Deferred to complete before continuing with the current thread. Here's an example (complete example at <a href="http://jsfiddle.net/DG3Ax/2/" rel="noreferrer">http://jsfiddle.net/DG3Ax/2/</a>)</p>
  
  <pre><code>function getSomething() {
      var def = getSomeDeferred();
  
      def.then(function(result) {
          dojo.place("&lt;li&gt;def.then() = " + result + "&lt;/li&gt;", "output");
      });
  
      return def.gimmeTheResultNow();
  }
  
  dojo.place("&lt;li&gt;getSomething() = " + getSomething() + "&lt;/li&gt;", "output");
  </code></pre>
  
  <p>Obviously <code>Deferred.gimmeTheResultNow()</code> does not exist, but that's the functionality I'm looking for. I don't have control of the code calling getSomething(), so I can't make it handle a Deferred; it needs the real result.</p>
  
  <p>I know xhrGet() has a sync parameter that I think would do the job if this were an AJAX call, but that isn't necessarily the case. Is there any other way to accomplish this?</p>