Options
All
  • Public
  • Public/Protected
  • All
Menu

Models an operation that executes periodically based on a specific interval.

Hierarchy

  • ThrottledOperation

Index

Constructors

constructor

  • new ThrottledOperation(period: number, action: function, cancelAction?: function): ThrottledOperation
  • Instantiate an the {@link framework.utils.ThrottledOperation} class.

    Parameters

    • period: number

      The number of milliseconds to wait between each application of the throttled operation.

    • action: function

      A function describing the action to throttle. If it returns true, it will be repeated. If not, the throttler will terminate.

        • (): boolean
        • Returns boolean

    • Optional cancelAction: function

      A function which will be called in the event that a throttling operation is cancelled midway.

        • (): void
        • Returns void

    Returns ThrottledOperation

Properties

Protected _setTimeoutToken

_setTimeoutToken: number

Private set timeout token reference.

action

action: function

A function describing the action to throttle. If it returns true, it will be repeated. If not the throttler will terminate.

Type declaration

    • (): boolean
    • Returns boolean

cancelAction

cancelAction: function

A function which will be called in the event that a throttling operation is cancelled midway.

Type declaration

    • (): any
    • Returns any

isActive

isActive: boolean

Boolean indicating whether this throttling operation is currently active or not.

period

period: number

The number of milliseconds to wait between each application of the throttled operation.

Methods

cancel

  • cancel(): void
  • This function cancels this throttled operation if it is in progress. If a cancelAction is specified, it will be invoked on cancellation.

    Returns void

Protected execute

  • Internal throttled operation implementation.

    Parameters

    Returns void