|
opt_interval
:
Number of ms between ticks (Default: 1ms).
|
|
opt_timerObject
:
An object that has setTimeout, setInterval, clearTimeout and clearInterval (eg Window).
|
dispatchTick()
Dispatches the TICK event. This is its own method so subclasses can override.
|
code » | ||
disposeInternal()
No description.
|
code » | ||
|
Gets the interval of the timer.
Returns:
interval Number of ms between ticks.
|
code » | ||
setInterval(interval)
Sets the interval of the timer.
Arguments:
|
code » | ||
start()
Starts the timer.
|
code » | ||
stop()
Stops the timer.
|
code » | ||
tick_()
Callback for the setTimeout used by the timer
|
code » |
addEventListener(type, handler, opt_capture, opt_handlerScope)
Adds an event listener to the event target. The same handler can only be
added once per the type. Even if you add the same handler multiple times
using the same type then it will only be called once when the event is
dispatched.
Supported for legacy but use goog.events.listen(src, type, handler) instead.
Arguments:
|
code » | |||||
|
Dispatches an event (or event like object) and calls all listeners
listening for events of this type. The type of the event is decided by the
type property on the event object.
If any of the listeners returns false OR calls preventDefault then this
function will return false. If one of the capture listeners calls
stopPropagation, then the bubble listeners won't fire.
Arguments:
Returns:
If anyone called preventDefault on the event object (or if any of the handlers returns false this will also return false.
|
code » | |||||
disposeInternal()
Unattach listeners from this object. Classes that extend EventTarget may
need to override this method in order to remove references to DOM Elements
and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() {
MyClass.superClass_.disposeInternal.call(this);
// Dispose logic for MyClass
};
|
code » | |||||
|
Returns the parent of this event target to use for bubbling.
Returns:
The parent EventTarget or null if there is no parent.
|
code » | |||||
removeEventListener(type, handler, opt_capture, opt_handlerScope)
Removes an event listener from the event target. The handler must be the
same object as the one added. If the handler has not been added then
nothing is done.
Arguments:
|
code » | |||||
setParentEventTarget(parent)
Sets the parent of this event target to use for bubbling.
Arguments:
|
code » |
dispose()
⇒ undefined
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:
undefined
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() {
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.
...
};
|
code » | ||
|
Use #isDisposed instead.
No description.
Returns:
Whether the object has been disposed of.
|
code » | ||
|
No description.
Returns:
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:
|
code » |
|
Cached tick_ bound to the object for later use in the timer.
|
Code » | |
|
Whether this timer is enabled
|
Code » | |
|
Number of ms between ticks
|
Code » | |
|
Firefox browser often fires the timer event sooner
(sometimes MUCH sooner) than the requested timeout. So we
compare the time to when the event was last fired, and
reschedule if appropriate. See also goog.Timer.intervalScale
|
Code » | |
|
An object that implements setTimout, setInterval, clearTimeout and
clearInterval. We default to the window object. Changing this on
goog.Timer.prototype changes the object for all timer instances which can
be useful if your environment has some other implementation of timers than
the window object.
|
Code » | |
|
Variable for storing the result of setInterval
|
Code » |
|
Calls the given function once, after the optional pause.
The function is always called asynchronously, even if the delay is 0. This
is a common trick to schedule a function to run after a batch of browser
event processing.
|
code » | ||
goog.Timer.clear(timerId)
Clears a timeout initiated by callOnce
Arguments:
|
code » |
|
Maximum timeout value.
Timeout values too big to fit into a signed 32-bit integer may cause
overflow in FF, Safari, and Chrome, resulting in the timeout being
scheduled immediately. It makes more sense simply not to schedule these
timeouts, since 24.8 days is beyond a reasonable expectation for the
browser to stay open.
|
Code » | |
|
Constant for the timer's event type
|
Code » | |
|
An object that implements setTimout, setInterval, clearTimeout and
clearInterval. We default to the window object. Changing this on
goog.Timer.prototype changes the object for all timer instances which can be
useful if your environment has some other implementation of timers than the
window object.
|
Code » | |
|
A variable that controls the timer error correction. If the
timer is called before the requested interval times
intervalScale, which often happens on mozilla, the timer is
rescheduled. See also this.last_
|
Code » |