tinybench - v6.0.0
    Preparing search index...

    Class Task

    A class that represents each benchmark task in Tinybench. It keeps track of the results, name, the task function, the number times the task function has been executed, ...

    Hierarchy

    • EventTarget
      • Task
    Index

    Constructors

    Properties

    addEventListener: <K extends TaskEvents>(
        type: K,
        listener: EventListener<K, "task"> | EventListenerObject<K, "task"> | null,
        options?: boolean | AddEventListenerOptions,
    ) => void

    The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

    MDN Reference

    removeEventListener: <K extends TaskEvents>(
        type: K,
        listener: EventListener<K, "task"> | EventListenerObject<K, "task"> | null,
        options?: boolean | EventListenerOptions,
    ) => void

    The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

    MDN Reference

    Accessors

    • get name(): string

      The name of the task.

      Returns string

      The task name as a string

    • get runs(): number

      The number of times the task function has been executed.

      Returns number

      The total number of executions performed

    Methods

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • Resets the task to make the Task.runs a zero-value and remove the Task.result object property.

      Parameters

      • emit: boolean = true

        whether to emit the reset event or not

      Returns void

    • Runs the current task and writes the results in Task.result object property.

      Returns Promise<Task>

      the current task

    • Runs the current task synchronously and writes the results in Task.result object property.

      Returns this

      the current task

    • Warms up the current task.

      Returns Promise<void>

    • Warms up the current task synchronously.

      Returns void