lib/ipromise/core.js
function safelyToExecutor(self, executor) {
  let done = false;
  try {
    executor(
      function(result) {
        if (done) return;
        done = true;
        doResolve.call(self, result);
      }, // doResolve
      function(error) {
        if (done) return;
        done = true;
        doReject.call(self, error);
      } // doReject
    );
  } catch (error) {
    if (done) return;
    done = true;
    doReject.call(self, error);
  }
}
function safelyToExecutor(self, executor) {
  let done = false;
  try {
    executor(
      function(result) {
        if (done) return;
        done = true;
        doResolve.call(self, result);
      }, // doResolve
      function(error) {
        if (done) return;
        done = true;
        doReject.call(self, error);
      } // doReject
    );
  } catch (error) {
    if (done) return;
    done = true;
    doReject.call(self, error);
  }
}
function safelyToExecutor ( self , executor ) { let done = false ; try { executor ( function ( result ) { if ( done ) return ; done = true ; doResolve . call ( self , result ) ; } , // doResolve function ( error ) { if ( done ) return ; done = true ; doReject . call ( self , error ) ; } // doReject ) ; } catch ( error ) { if ( done ) return ; done = true ; doReject . call ( self , error ) ; } }
onResolved or onRejected only one called once

@param { object } self current IPromise
@param { function } executor this's user operater
onResolved or onRejected only one called once