title: Pattern for async REST calls from javascript, and use result afterwards
body: <p>Basically, I have a couple of REST calls I need results from, and then use that result before and inside my require() call. Currently, I've instructed the REST calls ($.getJSON) to be non-async, with: </p>
  
  <pre><code>$.ajaxSetup({
      async: false
  });
  </code></pre>
  
  <p>But, since this is not optimal, I'm wondering how the pattern looks like for them calls to be async (or rather the functions that call them). </p>
  
  <p>Current (psuedo) code:</p>
  
  <pre><code>var pageConfig = getPageConfig(document); //this function calls a REST API
  var appsConfig = getAppsConfig(pageConfig.appid); //this function calls another REST API
  
  require.config( { 
      //do some stuff here with pageConfig and appsConfig
  });
  
  require( ["somelib", "jquery"], function(somelib) {
      //do some MORE stuff here with pageConfig and appsConfig
  });
  </code></pre>
  
  <p>I know this is probably not an optimal way of doing it, so I'm looking for options.</p>