Interface NetworkMetricsController

interface NetworkMetricsController {
    metrics: NetworkMetrics;
    addDownlinkTransferEntry(entry: NetworkTransferEntry): void;
    addMetricsEntry(entry: NetworkMetricsEntry): void;
    getServiceMetrics(serviceId: Maybe<string>): ServiceMetrics;
    hasAnyListeners(): boolean;
    hasListeners(type: "metricsChange"): boolean;
    on<K>(type: K, handler: EventHandler<NetworkMetricsEventMap[K]>, options?: SignalOptions): Unsubscribe;
}

Hierarchy (view full)

Implemented by

Properties

The current metrics state. The returned object is static at the time of request.

Methods

  • Adds information about a completed body content read.

    Parameters

    Returns void

  • Adds information about a completed settled request. Note: This does not update estimated bandwidth.

    Parameters

    Returns void

  • Returns metrics for the given service id. If the service id is nullish, or there is no history for the given service, empty service metrics will be returned.

    The returned object is static at the time of request.

    Parameters

    Returns ServiceMetrics

  • Returns true if the event host has any listeners for the given type.

    Parameters

    • type: "metricsChange"

    Returns boolean

  • Adds an event handler for the given typed event.

    Type Parameters

    • K extends "metricsChange"

    Parameters

    • type: K

      The key representing the event type to listen for.

    • handler: EventHandler<NetworkMetricsEventMap[K]>

      A callback to invoke when the event with the given type is dispatched.

    • Optionaloptions: SignalOptions

      Options for changing listening behavior.

    Returns Unsubscribe

    Returns a method, when invoked, removes the handler.