The goog.async.AnimationDelay Class

goog.async.AnimationDelay
> goog.Disposable

goog.async.AnimationDelay(listener, opt_window, opt_handler)

A delayed callback that pegs to the next animation frame instead of a user configurable timeout. By design, this should have the same interface as goog.async.Delay. Uses requestAnimationFrame and friends when available, but falls back to a timeout of goog.async.AnimationDelay.TIMEOUT. For more on requestAnimationFrame and how you can use it to create smoother animations, see:

listener {function(number)}
Function to call when the delay completes. Will be passed the timestamp when it's called, in unix ms.
opt_window {Window=}
The window object to execute the delay in. Defaults to the global object.
opt_handler {Object=}
The object scope to invoke the function in.
@see
http://paulirish.com/2011/requestanimationframe-for-smart-animating/

.TIMEOUT {number}

Default wait timeout for animations (in milliseconds). Only used for timed animation, which uses a timer (setTimeout) to schedule animation.

@const

.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()

Starts the delay timer. The provided listener function will be called before the next animation frame.

.stop()

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