Class RouteManager<T, I>

Class representing a RouteManager.

Type Parameters

  • T extends Record<string, any> = Record<string, any>

    Type for the route parameters.

  • I extends ISwitchItem = ISwitchItem

    Type for the route items.

Hierarchy (view full)

Observables

  • Applies a callback function to the values emitted by an observer.

    Type Parameters

    • T = any

      The type of values emitted by the observer.

    Parameters

    • callbackfn: ((value: TObserver<void>) => TObserver<T>)

      The callback function to apply to the emitted values.

        • (value): TObserver<T>
        • Parameters

          • value: TObserver<void>

          Returns TObserver<T>

    Returns TObserver<T>

    • An observer with the applied operator.

Other

  • Type Parameters

    • T extends Record<string, any> = Record<string, any>
    • I extends ISwitchItem = ISwitchItem

    Parameters

    • routes: I[]
    • history: MemoryHistory | BrowserHistory | HashHistory

    Returns RouteManager<T, I>

  • get item(): null | I
  • Retrieves the value of the item.

    Returns null | I

    The value of the item. Returns null if item is not set.

  • get params(): null | T
  • Returns the value of the params property.

    Returns null | T

    The value of the params property, which can be of type T or null.

  • Creates a debounced observer with an optional delay.

    Parameters

    • Optionaldelay: number

      The delay in milliseconds before emitting the data.

    Returns TObserver<void>

    • The debounced observer.
  • Creates a delayed observer with an optional delay.

    Parameters

    • Optionaldelay: number

      The delay in milliseconds before emitting the data.

    Returns TObserver<void>

    • The delayed observer.
  • Disposes of the current object by unsubscribing from any subscriptions.

    Returns void

    Object

    dispose

  • Applies a filtering function to the observer and returns a new observer with filtered values.

    Parameters

    • callbackfn: ((value: void) => boolean)

      A function that tests each value in the observer. Should return true or false.

        • (value): boolean
        • Parameters

          • value: void

          Returns boolean

    Returns TObserver<void>

    • A new observer with filtered values.
  • Applies a transformation function to each value emitted by the observer and flattens the result into a single observer.

    Type Parameters

    • T = any

      The type of values emitted by the observer.

    Parameters

    • callbackfn: ((value: void) => T[])

      The transformation function to apply to each value emitted by the observer.

        • (value): T[]
        • Parameters

          • value: void

          Returns T[]

    Returns TObserver<T>

    • The observer that emits the flattened values.
  • Maps the values of the observer using the given callback function.

    Type Parameters

    • T = any

      The type of the mapped values.

    Parameters

    • callbackfn: ((value: void) => T)

      A function that maps each value of the observer.

        • (value): T
        • Parameters

          • value: void

          Returns T

    Returns TObserver<T>

    • An observer with the mapped values.
  • Asynchronously maps the emitted values of the observer using the provided callback function.

    Type Parameters

    • T = any

      The type of the mapped values.

    Parameters

    • callbackfn: ((value: void) => Promise<T>)

      The callback function that maps the emitted values of the observer.

        • (value): Promise<T>
        • Parameters

          • value: void

          Returns Promise<T>

    • Optionalfallbackfn: ((e: Error) => void)

      The optional fallback function that handles errors during mapping.

        • (e): void
        • Parameters

          • e: Error

          Returns void

    Returns TObserver<T>

    • Returns a new observer that emits the mapped values.
  • Merges the provided observer with the current observer instance. Returns a new observer that emits values from both observers.

    Type Parameters

    • T = any

    Parameters

    • observer: TObserver<T>

      The observer to merge with the current observer.

    Returns TObserver<void | T>

    • A new observer that emits values from both observers.
  • Calls the next method to emit the specified data using the SUBJECT_EVENT event.

    Parameters

    • data: void

      The data to be emitted.

    Returns Promise<void>

    • Resolves when the emission is complete.
  • Executes the provided callback function only once. The callback function will be invoked when the specified event occurs for the first time.

    Parameters

    • callback: Function

      The function to be executed only once.

    Returns (() => void)

    • A function that removes the registered event listener.
      • (): void
      • Returns void

  • Applies a reducer function to each value emitted by the observer and returns a single accumulated value.

    Type Parameters

    • T = any

      The type of the accumulated value and emitted values

    Parameters

    • callbackfn: ((acm: T, cur: void) => T)

      A function that accepts the accumulated value and the current emitted value, and returns the new accumulated value

        • (acm, cur): T
        • Parameters

          • acm: T
          • cur: void

          Returns T

    • begin: T

      The initial value for the accumulator

    Returns TObserver<T>

    • An observer that emits the accumulated value when the original observer completes
  • Creates an observer that repeats emitting values at a specified interval.

    Parameters

    • Optionalinterval: number

      The time interval at which to repeat emitting values.

    Returns TObserver<void>

    • The created observer.
  • Splits the observed data into batches of arrays.

    Returns Observer<readonly void[]>

    • The observer that emits batches of arrays.
  • Subscribes to an event.

    Parameters

    • callback: Function

      The callback function to be invoked when the event is triggered.

    Returns (() => void)

    • A function to unsubscribe from the event.
      • (): void
      • Returns void

  • The tap function allows you to perform side effects without modifying the observed data.

    Parameters

    • callbackfn: ((value: void) => void)
        • (value): void
        • Parameters

          • value: void

          Returns void

    Returns TObserver<void>

  • Converts the current object to an iterator context.

    Returns {
        done(): void;
        iterate(): AsyncGenerator<void, void, unknown>;
    }

    The iterator context representing the current object.

    • done:function
      • Returns void

    • iterate:function
      • Returns AsyncGenerator<void, void, unknown>

  • Creates a new observer to observe the data emitted by a source.

    Returns TObserver<void>

    • The created observer.
  • Converts an observer-based asynchronous operation into a promise-based asynchronous operation.

    Returns Promise<void>

    A promise representing the completion or failure of the asynchronous operation.

    toPromise

  • Unsubscribes all event listeners.

    Returns void

    • No return value.

    unsubscribeAll