title: Callback for every loaded dependency in requirejs?
body: <p>I'd like to get a function called when javascript library is loaded by RequireJS. I'd use this to indicate initial initialisation to the user. It <strong>normally</strong> takes less than a second, but if it takes longer, user ends up staring on blank screen and thinking the web application is out of order. I imagine such screen:</p>
  
  <p><img src="https://i.stack.imgur.com/GL6DK.png" alt="image description"></p>
  
  <p>I can catch <strong>fails</strong>:</p>
  
  <pre><code>requirejs.onError = function(error) {
    error.requireModules.forEach(function(name) {
      //Create basename in case this was an URL
      name.replace(/^.*[/]/, "");
      // Debug
      console.warn("Module failed to load: ", name);
      // Find the loading node (they are hardcoded) and 
      // if it exists mark it as failed
      var element = document.getElementById("loading_"+name);
      if(element) {
        element.className+=" failed";
      }
    });
  }
  </code></pre>
  
  <p>So I can prepare popup like on that image and report failures in it. But reporting success is also important. Now there's one option <strong>I don't want to use</strong>:</p>
  
  <pre><code>var require = {
      deps: ["some/module1", "my/module2", "a.js", "b.js"],
      callback: function(module1, module2) {
          //This function will be called when all the dependencies
          //listed above in deps are loaded. Note that this
          //function could be called before the page is loaded.
          //This callback is optional.
      }
  };
  </code></pre>
  
  <p>Because:</p>
  
  <ul>
  <li>It only executes if <strong>all</strong> dependencies are loaded, rather than on every single one</li>
  <li>It would form another location I have to update if my dependencies change (and I'd have to keep it in sync with my loading popup)</li>
  </ul>
  
  <p>What I want is the <strong>opposite of <code>onError</code></strong>. Call callback every time modules are successfully loaded. It would be useful for debug purposes too.</p>