code: function(rejectIfAuthDataIsNull, rejectIfEmailNotVerified) {
        var self = this;
  
        // wait for the initial auth state to resolve; on page load we have to request auth state
        // asynchronously so we don't want to resolve router methods or flash the wrong state
        return this._initialAuthResolver.then(function() {
          // auth state may change in the future so rather than depend on the initially resolved state
          // we also check the auth data (synchronously) if a new promise is requested, ensuring we resolve
          // to the current auth state and not a stale/initial state
          var authData = self.getAuth(), res = null;
          if (rejectIfAuthDataIsNull && authData === null) {
            res = self._q.reject("AUTH_REQUIRED");
          }
          else if (rejectIfEmailNotVerified && !authData.emailVerified) {
              res = self._q.reject("EMAIL_VERIFICATION_REQUIRED");
          }
          else {
            res = self._q.when(authData);
          }
          return res;
        });
      }
docs: Helper onAuthStateChanged() callback method for the two router-related methods.
  
  @param {boolean} rejectIfAuthDataIsNull Determines if the returned promise should be
  resolved or rejected upon an unauthenticated client.
  @param {boolean} rejectIfEmailNotVerified Determines if the returned promise should be
  resolved or rejected upon a client without a verified email address.
  @return {Promise<Object>} A promise fulfilled with the client's authentication state or
  rejected if the client is unauthenticated and rejectIfAuthDataIsNull is true.