Home

# Class goog.async.Throttle

Throttle will perform an action that is passed in no more than once per interval (specified in milliseconds). If it gets multiple signals to perform the action while it is waiting, it will only perform the action once at the end of the interval.

extends goog.Disposable

Instance Method Summary

`disposeInternal()`

Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:

    mypackage.MyClass = function() {
    goog.base(this);
    // Constructor logic specific to MyClass.
    ...
    };
    goog.inherits(mypackage.MyClass, goog.Disposable);

    mypackage.MyClass.prototype.disposeInternal = function() {
    goog.base(this, 'disposeInternal');
    // Dispose logic specific to MyClass.
    ...
    };

| `doAction_()` Calls the callback
| `fire()` Notifies the throttle that the action has happened. It will throttle the call so that the callback is not called too often according to the interval parameter passed to the constructor.
| `onTimer_()` Handler for the timer to fire the throttle
| `pause()` Pauses the throttle. All pending and future action callbacks will be delayed until the throttle is resumed. Pauses can be nested.
| `resume()` Resumes the throttle. If doing so drops the pausing count to zero, pending action callbacks will be executed as soon as possible, but still no sooner than an interval's delay after the previous call. Future action callbacks will be executed as normal.
| `stop()` Cancels any pending action callback. The throttle can be restarted by calling {@link #fire}.