The goog.async.Delay Class

goog.async.Delay
> goog.Disposable

goog.async.Delay(listener, opt_interval, opt_handler)

A Delay object invokes the associated function after a specified delay. The interval duration can be specified once in the constructor, or can be defined each time the delay is started. Calling start on an active delay will reset the timer.

listener {Function}
Function to call when the delay completes.
opt_interval {number=}
The default length of the invocation delay (in milliseconds).
opt_handler {Object=}
The object scope to invoke the function in.

.addOnDisposeCallback(callback, opt_scope)

Inherited from goog.Disposable .

Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.

callback {!Function}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.dispose()

Inherited from goog.Disposable .

Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.

returns {void}
Nothing.

.fire()

Fires delay's action even if timer has already gone off or has not been started yet; guarantees action firing. Stops the delay timer.

.fireIfActive()

Fires delay's action only if timer is currently active. Stops the delay timer.

.isActive()

returns {boolean}
True if the delay is currently active, false otherwise.

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.start(opt_interval)

Starts the delay timer. The provided listener function will be called after the specified interval. Calling start on an active timer will reset the delay interval.

opt_interval {number=}
If specified, overrides the object's default interval with this one (in milliseconds).

.stop()

Stops the delay timer if it is active. No action is taken if the timer is not in use.