title: Implement promises pattern
body: <p>I have a function that called with other objects and  when my application is loaded, get parameter and the function should wait for call with all of object and then execute so with promises pattern i can  ensure all object is loaded but i don't know about count of object and i don't want set timeout for loading.I don't talk about specific technology such as <code>jquery</code> and need algorithm.</p>
  
  <p>Pseudo Code:</p>
  
  <pre><code>      function loadWidget(id){
          list.push(id);
         //here I should ensure all Widget is loaded
  
  
            }
  </code></pre>
  
  <p>in other application i call</p>
  
  <pre><code>    app.loadWidget.add(widget1.id);
      .
      .
      .      
      app.loadWidget.add(widget2.id);
  </code></pre>