Promiseは両目がぼんやりしていることから両目に光を放つことまで(5)-手書きPromiseの全体構造


    ,show you my code
/**  
 * IIFE 
 */
 (function (window) {  
  
  /**  
   * Promise       
   * @param executor          
   * @constructor  
   */  
  function Promise(executor) {  
  
  }  
  
  /**  
   * Promise     then() 
   * @param onResolved       
   * @param onRejected       
   * @return     Promise    
   */  
 Promise.prototype.then = function (onResolved, onRejected) {  
  
  }  
 
  /**  
   * Promise     catch() 
   * @param onRejected       
   * @return     Promise    
   */  
 Promise.prototype.catch = function (onRejected) {  
  
  }  
  
  /**  
   * Promise     resolve 
   * @param value        
   * @return       value    Promise    
   */  
 Promise.resolve = function (value) {  
  
  }  
  
  /**  
   * Promise     reject 
   * @param value        
   * @return       reason    Promise    
   */  
 Promise.reject = function (reason) {  
  
  }  
  
  /**  
   * Promise     all 
   * @param promises   /promise       
   * @return     promise         
   */  
 Promise.all = function (promises) {  
  
  }  
  
  /**  
   * Promise     race 
   * @param promises   /promise       
   * @return     promise  ,          promise    
   */ 
 Promise.race = function (promises) {  
  
  }  
  
  //    Promise  
  window.Promise = Promise  
})(window)
コードは同期してgithubに更新されました.
https://github.com/hnt815/promise