Class PrimitiveTracker<V, TResult>Abstract

Base tracker class

Type Parameters

  • V extends number | string
  • TResult

Hierarchy (view full)

Constructors

Properties

debug: boolean
id: string
timestamps: number[]
values: V[]

Accessors

  • get elapsed(): number
  • Returns the elapsed time, in milliseconds since the instance was created

    Returns number

  • get initial(): undefined | V
  • Returns the initial value, or undefined

    Returns undefined | V

  • get last(): undefined | V
  • Returns undefined | V

  • get size(): number
  • Returns number of recorded values (this can include the initial value)

    Returns number

Methods

  • Adds a value, returning computed result.

    At this point, we check if the buffer is larger than resetAfterSamples. If so, reset() is called. If not, we check sampleLimit. If the buffer is twice as large as sample limit, trimStore() is called to take it down to sample limit, and onTrimmed() is called.

    Parameters

    • Rest...p: V[]

    Returns TResult

  • Reduces size of value store to limit. Returns number of remaining items

    Parameters

    • limit: number

    Returns number