bundle.js
/**
 * Runs all hook functions serially and calls callback(error) when finished.
 * A hook may return a promise if it needs to execute asynchronously.
 */
Runs all hook functions serially and calls callback(error) when finished.
A hook may return a promise if it needs to execute asynchronously.
Runs all hook functions serially and calls callback ( error ) when finished . A hook may return a promise if it needs to execute asynchronously .
function runHooks(hooks, callback) {
  var promise;
  try {
    promise = hooks.reduce(function (promise, hook) {
      return promise ? promise.then(hook) : hook();
    }, null);
  } catch (error) {
    return callback(error); 
  }
  if (promise) {
    promise.then(function () {
      setTimeout(callback);
    }, function (error) {
      setTimeout(function () {
        callback(error);
      });
    });
  } else {
    callback();
  }
}
function runHooks ( hooks , callback ) { var promise ; try { promise = hooks . reduce ( function ( promise , hook ) { return promise ? promise . then ( hook ) : hook ( ) ; } , null ) ; } catch ( error ) { return callback ( error ) ; } if ( promise ) { promise . then ( function ( ) { setTimeout ( callback ) ; } , function ( error ) { setTimeout ( function ( ) { callback ( error ) ; } ) ; } ) ; } else { callback ( ) ; } }
Runs all hook functions serially and calls callback(error) when finished.
Runs all hook functions serially and calls callback ( error ) when finished .
// The first hook to use transition.wait makes the rest // of the transition async from that point forward. // Sync error. // Use setTimeout to break the promise chain.