Home Reference Source
import {Throttler} from 'arva-js/utils/Throttler.js'
public class | source

Throttler

Constructor Summary

Public Constructor
public

constructor(throttleDelay: Number, shouldQueue: Boolean, actionContext: Object, useTicks: Boolean): Throttler

Member Summary

Public Members
public
public

delay: *

public
public

queue: *

public
public

timer: *

Method Summary

Public Methods
public

add(action: Function): void

Adds an executable action to the queue that will be executed consecutively by the Throttler.

Public Constructors

public constructor(throttleDelay: Number, shouldQueue: Boolean, actionContext: Object, useTicks: Boolean): Throttler source

Params:

NameTypeAttributeDescription
throttleDelay Number

Minimum amount of time in between each action executed by the Throttler, in milliseconds or ticks.

shouldQueue Boolean

Enable if each added action should be executed consecutively, or disable if a newly added action should replace a previous one.

actionContext Object

Context to which the actions executed by the Throttler will be bound.

useTicks Boolean

whether ticks should be used instead of milliseconds

Return:

Throttler

Throttler instance.

Public Members

public actionContext: * source

public delay: * source

public executionTimer: * source

public queue: * source

public shouldQueue: * source

public timer: * source

Public Methods

public add(action: Function): void source

Adds an executable action to the queue that will be executed consecutively by the Throttler. If Throttler was constructed with shouldQueue = false, adding a new action will remove the old one.

Params:

NameTypeAttributeDescription
action Function

Function to execute.

Return:

void