Class Middleware<Context>

Type Parameters

Constructors

Properties

disabled: boolean

Is this middleware disabled?

The function to execute when this middleware is called

executedCount: number = 0

The number of times this middleware has been executed

Hooks to execute before and after the middleware is executed

lastExecutedResult: unknown = null

The last result of this middleware

lastExecutedRuntime: null | number = null

The last runtime of this middleware in milliseconds

lastExecutedTs: null | number = null

The last time this middleware was executed

runtimeAverage: null | number = null

The average runtime of this middleware

runtimeHighest: null | number = null

Highest runtime seen for this middleware

runtimeLowest: null | number = null

Lowest runtime seen for this middleware

runtimeStandardDeviation: null | number = null

Standard deviation of runtime for this middleware

runtimeTotal: number = 0

Total runtime of this middleware

runtimeVariance: null | number = null

Variance of runtime for this middleware

default: {
    disabled: boolean;
    execute: (() => void);
    hooks: {
        after: null;
        before: null;
        onError: null;
    };
} = ...

Type declaration

  • disabled: boolean
  • execute: (() => void)
      • (): void
      • Returns void

  • hooks: {
        after: null;
        before: null;
        onError: null;
    }
    • after: null
    • before: null
    • onError: null

Methods

  • Calculates the standard deviation of the runtime for this middleware

    Returns null | number

    The standard deviation of the runtime for this middleware

  • Calculates the variance of the runtime for this middleware

    Returns null | number

    The variance of the runtime for this middleware

  • Updates the runtime statistics for this middleware

    Parameters

    • runtime: number

    Returns void