async.AnimationDelay Extends goog.Disposable
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:

Inheritance

Constructor

goog.async.AnimationDelay(listeneropt_windowopt_handler)

Parameters

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.

Instance Methods

Public Protected Private
callback_()
Cached callback function invoked when the delay finishes.
code »
disposeInternal()
No description.
code »
doAction_()
Invokes the callback function after the delay successfully completes.
code »
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.
code »
fireIfActive()
Fires delay's action only if timer is currently active. Stops the delay timer.
code »
getCancelRaf_() ?function(number): number
No description.
Returns: ?function(number): number  The cancelAnimationFrame function, or null if not available on this browser.
code »
getRaf_() ?function(function(number)): number
No description.
Returns: ?function(function(number)): number  The requestAnimationFrame function, or null if not available on this browser.
code »
isActive() boolean
No description.
Returns: boolean  True if the delay is currently active, false otherwise.
code »
listener_()
The function that will be invoked after a delay.
code »
start()
Starts the delay timer. The provided listener function will be called before the next animation frame.
code »
stop()
Stops the delay timer if it is active. No action is taken if the timer is not in use.
code »
addOnDisposeCallback(callbackopt_scope)
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
Arguments:
callback : function(this:T):?
The callback function.
opt_scope : T=
An optional scope to call the callback in.
code »
dispose() void
Disposes of the object. If the object hasn't already been disposed of, calls #disposeInternal. Classes that extend goog.Disposable should override #disposeInternal in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
Returns: void  Nothing.
code »
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend goog.Disposable should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' disposeInternal method. Everywhere else the public dispose method must be used. For example:
  mypackage.MyClass = function() {
    mypackage.MyClass.base(this, 'constructor');
    // Constructor logic specific to MyClass.
    ...
  };
  goog.inherits(mypackage.MyClass, goog.Disposable);

  mypackage.MyClass.prototype.disposeInternal = function() {
    // Dispose logic specific to MyClass.
    ...
    // Call superclass's disposeInternal at the end of the subclass's, like
    // in C++, to avoid hard-to-catch issues.
    mypackage.MyClass.base(this, 'disposeInternal');
  };
code »
getDisposed() boolean
Use #isDisposed instead. No description.
Returns: boolean  Whether the object has been disposed of.
code »
isDisposed() boolean
No description.
Returns: boolean  Whether the object has been disposed of.
code »
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed together.
Arguments:
disposable : goog.disposable.IDisposable
that will be disposed when this object is disposed.
code »

Instance Properties

constructor :
No description.
Code »
handler_ :
The object context to invoke the callback in.
Code »
id_ :
Identifier of the active delay timeout, or event listener, or null when inactive.
Code »
usingListeners_ :
If we're using dom listeners.
Code »
win_ :
No description.
Code »
creationStack :
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
Code »
disposed_ :
Whether the object has been disposed of.
Code »
onDisposeCallbacks_ :
Callbacks to invoke when this object is disposed.
Code »

Static Properties

goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_ :
Name of event received from the requestAnimationFrame in Firefox.
Code »
goog.async.AnimationDelay.TIMEOUT :
Default wait timeout for animations (in milliseconds). Only used for timed animation, which uses a timer (setTimeout) to schedule animation.
Code »
goog.async.AnimationDelay.superClass_ :
No description.
Code »

Package async

Package Reference