@inrupt/solid-client-authn-browser
    Preparing search index...

    Interface ISessionEventListener

    interface ISessionEventListener {
        "[captureRejectionSymbol]"?<K>(
            error: Error,
            event: string | symbol,
            ...args: AnyRest,
        ): void;
        addListener(eventName: "login", listener: () => void): this;
        addListener(eventName: "logout", listener: () => void): this;
        addListener(eventName: "sessionExpired", listener: () => void): this;
        addListener(
            eventName: "sessionRestore",
            listener: (currentUrl: string) => unknown,
        ): this;
        addListener(
            eventName: "error",
            listener: (
                error: null | string,
                errorDescription?: null | string | Error,
            ) => unknown,
        ): this;
        addListener(
            eventName: "sessionExtended",
            listener: (expiresIn: number) => void,
        ): this;
        addListener(
            eventName: "timeoutSet",
            listener: (timeoutId: number) => void,
        ): this;
        addListener(
            eventName: "newRefreshToken",
            listener: (newToken: string) => void,
        ): this;
        addListener(
            eventName: "newTokens",
            listener: (tokenSet: SessionTokenSet) => void,
        ): this;
        addListener(
            eventName: "authorizationRequest",
            listener: (authorizationRequestState: AuthorizationRequestState) => void,
        ): this;
        eventNames(): (string | symbol)[];
        getMaxListeners(): number;
        listenerCount<K>(eventName: string | symbol, listener?: Function): number;
        listeners<K>(eventName: string | symbol): Function[];
        off(eventName: "login", listener: () => void): this;
        off(eventName: "logout", listener: () => void): this;
        off(eventName: "sessionExpired", listener: () => void): this;
        off(
            eventName: "sessionRestore",
            listener: (currentUrl: string) => unknown,
        ): this;
        off(
            eventName: "error",
            listener: (
                error: null | string,
                errorDescription?: null | string | Error,
            ) => unknown,
        ): this;
        off(
            eventName: "sessionExtended",
            listener: (expiresIn: number) => void,
        ): this;
        off(eventName: "timeoutSet", listener: (timeoutId: number) => void): this;
        off(
            eventName: "newRefreshToken",
            listener: (newToken: string) => void,
        ): this;
        off(
            eventName: "newTokens",
            listener: (tokenSet: SessionTokenSet) => void,
        ): this;
        off(
            eventName: "authorizationRequest",
            listener: (authorizationRequestState: AuthorizationRequestState) => void,
        ): this;
        on(eventName: "login", listener: () => void): this;
        on(eventName: "logout", listener: () => void): this;
        on(eventName: "sessionExpired", listener: () => void): this;
        on(
            eventName: "sessionRestore",
            listener: (currentUrl: string) => unknown,
        ): this;
        on(
            eventName: "error",
            listener: (
                error: null | string,
                errorDescription?: null | string | Error,
            ) => unknown,
        ): this;
        on(
            eventName: "sessionExtended",
            listener: (expiresIn: number) => void,
        ): this;
        on(eventName: "timeoutSet", listener: (timeoutId: number) => void): this;
        on(
            eventName: "newRefreshToken",
            listener: (newToken: string) => void,
        ): this;
        on(
            eventName: "newTokens",
            listener: (tokenSet: SessionTokenSet) => void,
        ): this;
        on(
            eventName: "authorizationRequest",
            listener: (authorizationRequestState: AuthorizationRequestState) => void,
        ): this;
        once(eventName: "login", listener: () => void): this;
        once(eventName: "logout", listener: () => void): this;
        once(eventName: "sessionExpired", listener: () => void): this;
        once(
            eventName: "sessionRestore",
            listener: (currentUrl: string) => unknown,
        ): this;
        once(
            eventName: "error",
            listener: (
                error: null | string,
                errorDescription?: null | string | Error,
            ) => unknown,
        ): this;
        once(
            eventName: "sessionExtended",
            listener: (expiresIn: number) => void,
        ): this;
        once(eventName: "timeoutSet", listener: (timeoutId: number) => void): this;
        once(
            eventName: "newRefreshToken",
            listener: (newToken: string) => void,
        ): this;
        once(
            eventName: "newTokens",
            listener: (tokenSet: SessionTokenSet) => void,
        ): this;
        once(
            eventName: "authorizationRequest",
            listener: (authorizationRequestState: AuthorizationRequestState) => void,
        ): this;
        prependListener<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        prependOnceListener<K>(
            eventName: string | symbol,
            listener: (...args: any[]) => void,
        ): this;
        rawListeners<K>(eventName: string | symbol): Function[];
        removeAllListeners(eventName?: string | symbol): this;
        removeListener(eventName: "login", listener: () => void): this;
        removeListener(eventName: "logout", listener: () => void): this;
        removeListener(eventName: "sessionExpired", listener: () => void): this;
        removeListener(
            eventName: "sessionRestore",
            listener: (currentUrl: string) => unknown,
        ): this;
        removeListener(
            eventName: "error",
            listener: (
                error: null | string,
                errorDescription?: null | string | Error,
            ) => unknown,
        ): this;
        removeListener(
            eventName: "sessionExtended",
            listener: (expiresIn: number) => void,
        ): this;
        removeListener(
            eventName: "timeoutSet",
            listener: (timeoutId: number) => void,
        ): this;
        removeListener(
            eventName: "newRefreshToken",
            listener: (newToken: string) => void,
        ): this;
        removeListener(
            eventName: "newTokens",
            listener: (tokenSet: SessionTokenSet) => void,
        ): this;
        removeListener(
            eventName: "authorizationRequest",
            listener: (authorizationRequestState: AuthorizationRequestState) => void,
        ): this;
        setMaxListeners(n: number): this;
    }

    Hierarchy

    • EventEmitter
      • ISessionEventListener
    Index

    Methods

    • Type Parameters

      • K

      Parameters

      • error: Error
      • event: string | symbol
      • ...args: AnyRest

      Returns void

    • Register a listener called on successful login.

      Parameters

      • eventName: "login"

        The login event name

      • listener: () => void

        The callback called on successful login

      Returns this

    • Register a listener called on successful logout.

      Parameters

      • eventName: "logout"

        The logout event name.

      • listener: () => void

        The callback called on successful logout.

      Returns this

    • Register a listener called on session expiration.

      Parameters

      • eventName: "sessionExpired"

        The session expiration event name.

      • listener: () => void

        The callback called on session expiration.

      Returns this

    • Register a listener called on session restoration after a silent login.

      Parameters

      • eventName: "sessionRestore"

        The session restoration event name.

      • listener: (currentUrl: string) => unknown

        The callback called on successful session restore.

      Returns this

    • Register a listener called on error, with an error identifier and description.

      Parameters

      • eventName: "error"

        The error event name.

      • listener: (error: null | string, errorDescription?: null | string | Error) => unknown

        The callback called on error.

      Returns this

    • Register a listener called on session extension.

      Parameters

      • eventName: "sessionExtended"

        The session extension event name.

      • listener: (expiresIn: number) => void

        The callback called on session extension.

      Returns this

    • Register a listener called when a timeout is set for a session event with the timeout handle.

      Parameters

      • eventName: "timeoutSet"

        The timeout set event name.

      • listener: (timeoutId: number) => void

        The callback called when setting a timeout.

      Returns this

    • Register a listener called when a new refresh token is issued for the session.

      Parameters

      • eventName: "newRefreshToken"

        The new refresh token issued event name.

      • listener: (newToken: string) => void

        The callback called when a new refresh token is issued.

      Returns this

      Use NEW_TOKENS event listeners instead

    • Register a listener called when new tokens are issued for the session.

      Parameters

      • eventName: "newTokens"

        The new tokens issued event name.

      • listener: (tokenSet: SessionTokenSet) => void

        The callback called when new tokens are issued.

      Returns this

    • Register a listener called when auth state information is available during authentication.

      Parameters

      • eventName: "authorizationRequest"

        The auth state event name.

      • listener: (authorizationRequestState: AuthorizationRequestState) => void

        The callback called when auth state information is available.

      Returns this

    • Returns an array listing the events for which the emitter has registered listeners. The values in the array are strings or Symbols.

      import { EventEmitter } from 'node:events';

      const myEE = new EventEmitter();
      myEE.on('foo', () => {});
      myEE.on('bar', () => {});

      const sym = Symbol('symbol');
      myEE.on(sym, () => {});

      console.log(myEE.eventNames());
      // Prints: [ 'foo', 'bar', Symbol(symbol) ]

      Returns (string | symbol)[]

      v6.0.0

    • Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter.defaultMaxListeners.

      Returns number

      v1.0.0

    • Returns the number of listeners listening for the event named eventName. If listener is provided, it will return how many times the listener is found in the list of the listeners of the event.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event being listened for

      • Optionallistener: Function

        The event handler function

      Returns number

      v3.2.0

    • Returns a copy of the array of listeners for the event named eventName.

      server.on('connection', (stream) => {
      console.log('someone connected!');
      });
      console.log(util.inspect(server.listeners('connection')));
      // Prints: [ [Function] ]

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      v0.1.26

    • Unegister a listener called on successful login with the logged in WebID.

      Parameters

      • eventName: "login"

        The login event name.

      • listener: () => void

        The callback to unregister.

      Returns this

    • Unegister a listener called on successful logout.

      Parameters

      • eventName: "logout"

        The logout event name.

      • listener: () => void

        The callback to unregister.

      Returns this

    • Unegister a listener called on session expiration.

      Parameters

      • eventName: "sessionExpired"

        The session expiration event name.

      • listener: () => void

        The callback to unregister.

      Returns this

    • Unegister a listener called on session restoration after a silent login.

      Parameters

      • eventName: "sessionRestore"

        The session restoration event name.

      • listener: (currentUrl: string) => unknown

        The callback to unregister.

      Returns this

    • Unegister a listener called on error, with an error identifier and description.

      Parameters

      • eventName: "error"

        The error event name.

      • listener: (error: null | string, errorDescription?: null | string | Error) => unknown

        The callback to unregister.

      Returns this

    • Unegister a listener called on session extension.

      Parameters

      • eventName: "sessionExtended"

        The session extension event name.

      • listener: (expiresIn: number) => void

        The callback to unregister.

      Returns this

    • Unegister a listener called when a timeout is set for a session event.

      Parameters

      • eventName: "timeoutSet"

        The timeout set event name.

      • listener: (timeoutId: number) => void

        The callback called when next setting a timeout.

      Returns this

    • Unegister a listener called when a new refresh token is issued.

      Parameters

      • eventName: "newRefreshToken"

        The new refresh token issued event name.

      • listener: (newToken: string) => void

        The callback called next time a new refresh token is issued.

      Returns this

      Use NEW_TOKENS event listeners instead

    • Unegister a listener called when new tokens are issued.

      Parameters

      • eventName: "newTokens"

        The new tokens issued event name.

      • listener: (tokenSet: SessionTokenSet) => void

        The callback called next time new tokens are issued.

      Returns this

    • Unregister a listener called when auth state information is available.

      Parameters

      • eventName: "authorizationRequest"

        The auth state event name.

      • listener: (authorizationRequestState: AuthorizationRequestState) => void

        The callback to unregister.

      Returns this

    • Register a listener called on successful login.

      Parameters

      • eventName: "login"

        The login event name

      • listener: () => void

        The callback called on successful login

      Returns this

    • Register a listener called on successful logout.

      Parameters

      • eventName: "logout"

        The logout event name.

      • listener: () => void

        The callback called on successful logout.

      Returns this

    • Register a listener called on session expiration.

      Parameters

      • eventName: "sessionExpired"

        The session expiration event name.

      • listener: () => void

        The callback called on session expiration.

      Returns this

    • Register a listener called on session restoration after a silent login.

      Parameters

      • eventName: "sessionRestore"

        The session restoration event name.

      • listener: (currentUrl: string) => unknown

        The callback called on successful session restore.

      Returns this

    • Register a listener called on error, with an error identifier and description.

      Parameters

      • eventName: "error"

        The error event name.

      • listener: (error: null | string, errorDescription?: null | string | Error) => unknown

        The callback called on error.

      Returns this

    • Register a listener called on session extension.

      Parameters

      • eventName: "sessionExtended"

        The session extension event name.

      • listener: (expiresIn: number) => void

        The callback called on session extension.

      Returns this

    • Register a listener called when a timeout is set for a session event with the timeout handle.

      Parameters

      • eventName: "timeoutSet"

        The timeout set event name.

      • listener: (timeoutId: number) => void

        The callback called when setting a timeout.

      Returns this

    • Register a listener called when a new refresh token is issued for the session.

      Parameters

      • eventName: "newRefreshToken"

        The new refresh token issued event name.

      • listener: (newToken: string) => void

        The callback called when a new refresh token is issued.

      Returns this

      Use NEW_TOKENS event listeners instead

    • Register a listener called when new tokens are issued for the session.

      Parameters

      • eventName: "newTokens"

        The new tokens issued event name.

      • listener: (tokenSet: SessionTokenSet) => void

        The callback called when new tokens are issued.

      Returns this

    • Register a listener called when auth state information is available during authentication.

      Parameters

      • eventName: "authorizationRequest"

        The auth state event name.

      • listener: (authorizationRequestState: AuthorizationRequestState) => void

        The callback called when auth state information is available.

      Returns this

    • Register a listener called on the next successful login with the logged in WebID.

      Parameters

      • eventName: "login"

        The login event name.

      • listener: () => void

        The callback called on the next successful login.

      Returns this

    • Register a listener called on the next successful logout.

      Parameters

      • eventName: "logout"

        The logout event name.

      • listener: () => void

        The callback called on the next successful logout.

      Returns this

    • Register a listener called on the next session expiration.

      Parameters

      • eventName: "sessionExpired"

        The session expiration event name.

      • listener: () => void

        The callback called on the next session expiration.

      Returns this

    • Register a listener called on the next session restoration after a silent login.

      Parameters

      • eventName: "sessionRestore"

        The session restoration event name.

      • listener: (currentUrl: string) => unknown

        The callback called on the next successful session restore.

      Returns this

    • Register a listener called on the next error, with an error identifier and description.

      Parameters

      • eventName: "error"

        The error event name.

      • listener: (error: null | string, errorDescription?: null | string | Error) => unknown

        The callback called on the next error.

      Returns this

    • Register a listener called on the next session extension.

      Parameters

      • eventName: "sessionExtended"

        The session extension event name.

      • listener: (expiresIn: number) => void

        The callback called on the next session extension.

      Returns this

    • Register a listener called the next time a timeout is set for a session event with the timeout handle.

      Parameters

      • eventName: "timeoutSet"

        The timeout set event name.

      • listener: (timeoutId: number) => void

        The callback called when next setting a timeout.

      Returns this

    • Register a listener called the next time a new refresh token is issued for the session.

      Parameters

      • eventName: "newRefreshToken"

        The new refresh token issued event name.

      • listener: (newToken: string) => void

        The callback called next time a new refresh token is issued.

      Returns this

      Use NEW_TOKENS event listeners instead

    • Register a listener called the next time new tokens are issued for the session.

      Parameters

      • eventName: "newTokens"

        The new tokens issued event name.

      • listener: (tokenSet: SessionTokenSet) => void

        The callback called next time new tokens are issued.

      Returns this

      2.4.0

    • Register a listener called the next time auth state information is available during authentication.

      Parameters

      • eventName: "authorizationRequest"

        The auth state event name.

      • listener: (authorizationRequestState: AuthorizationRequestState) => void

        The callback called next time auth state information is available.

      Returns this

    • Adds the listener function to the beginning of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

      server.prependListener('connection', (stream) => {
      console.log('someone connected!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v6.0.0

    • Adds a one-timelistener function for the event named eventName to the beginning of the listeners array. The next time eventName is triggered, this listener is removed, and then invoked.

      server.prependOnceListener('connection', (stream) => {
      console.log('Ah, we have our first user!');
      });

      Returns a reference to the EventEmitter, so that calls can be chained.

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

        The name of the event.

      • listener: (...args: any[]) => void

        The callback function

      Returns this

      v6.0.0

    • Returns a copy of the array of listeners for the event named eventName, including any wrappers (such as those created by .once()).

      import { EventEmitter } from 'node:events';
      const emitter = new EventEmitter();
      emitter.once('log', () => console.log('log once'));

      // Returns a new Array with a function `onceWrapper` which has a property
      // `listener` which contains the original listener bound above
      const listeners = emitter.rawListeners('log');
      const logFnWrapper = listeners[0];

      // Logs "log once" to the console and does not unbind the `once` event
      logFnWrapper.listener();

      // Logs "log once" to the console and removes the listener
      logFnWrapper();

      emitter.on('log', () => console.log('log persistently'));
      // Will return a new Array with a single function bound by `.on()` above
      const newListeners = emitter.rawListeners('log');

      // Logs "log persistently" twice
      newListeners[0]();
      emitter.emit('log');

      Type Parameters

      • K

      Parameters

      • eventName: string | symbol

      Returns Function[]

      v9.4.0

    • Removes all listeners, or those of the specified eventName.

      It is bad practice to remove listeners added elsewhere in the code, particularly when the EventEmitter instance was created by some other component or module (e.g. sockets or file streams).

      Returns a reference to the EventEmitter, so that calls can be chained.

      Parameters

      • OptionaleventName: string | symbol

      Returns this

      v0.1.26

    • Unegister a listener called on successful login with the logged in WebID.

      Parameters

      • eventName: "login"

        The login event name.

      • listener: () => void

        The callback to unregister.

      Returns this

    • Unegister a listener called on successful logout.

      Parameters

      • eventName: "logout"

        The logout event name.

      • listener: () => void

        The callback to unregister.

      Returns this

    • Unegister a listener called on session expiration.

      Parameters

      • eventName: "sessionExpired"

        The session expiration event name.

      • listener: () => void

        The callback to unregister.

      Returns this

    • Unegister a listener called on session restoration after a silent login.

      Parameters

      • eventName: "sessionRestore"

        The session restoration event name.

      • listener: (currentUrl: string) => unknown

        The callback to unregister.

      Returns this

    • Unegister a listener called on error, with an error identifier and description.

      Parameters

      • eventName: "error"

        The error event name.

      • listener: (error: null | string, errorDescription?: null | string | Error) => unknown

        The callback to unregister.

      Returns this

    • Unegister a listener called on session extension.

      Parameters

      • eventName: "sessionExtended"

        The session extension event name.

      • listener: (expiresIn: number) => void

        The callback to unregister.

      Returns this

    • Unegister a listener called when a timeout is set for a session event.

      Parameters

      • eventName: "timeoutSet"

        The timeout set event name.

      • listener: (timeoutId: number) => void

        The callback called when next setting a timeout.

      Returns this

    • Unegister a listener called when a new refresh token is issued.

      Parameters

      • eventName: "newRefreshToken"

        The new refresh token issued event name.

      • listener: (newToken: string) => void

        The callback called next time a new refresh token is issued.

      Returns this

      Use NEW_TOKENS event listeners instead

    • Unegister a listener called when new tokens are issued.

      Parameters

      • eventName: "newTokens"

        The new tokens issued event name.

      • listener: (tokenSet: SessionTokenSet) => void

        The callback called next time new tokens are issued.

      Returns this

    • Unregister a listener called when auth state information is available.

      Parameters

      • eventName: "authorizationRequest"

        The auth state event name.

      • listener: (authorizationRequestState: AuthorizationRequestState) => void

        The callback to unregister.

      Returns this

    • By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default that helps finding memory leaks. The emitter.setMaxListeners() method allows the limit to be modified for this specific EventEmitter instance. The value can be set to Infinity (or 0) to indicate an unlimited number of listeners.

      Returns a reference to the EventEmitter, so that calls can be chained.

      Parameters

      • n: number

      Returns this

      v0.3.5