true the conditional delay is cancelled and #onSuccess
is called. Otherwise this object keeps to invoke the deferred function until
either it returns true or the timeout is exceeded. In the latter case
the #onFailure method will be called.
The interval duration and timeout can be specified each time the delay is
started. Calling start on an active delay will reset the timer.
| goog.Disposable | |
| goog.async.ConditionalDelay | goog.Disposable |
|
listener
: function (): boolean
Function to call when the delay completes. Should return a value that type-converts to
true if the call succeeded and this delay should be stopped. |
|
opt_handler
:
The object scope to invoke the function in.
|
disposeInternal()
No description.
|
code » | |||
|
No description.
Returns:
True if the delay is currently active, false otherwise.
|
code » | |||
|
No description.
Returns:
True if the listener has been executed and returned
true since the last call to #start.
|
code » | |||
listener_()
The function that will be invoked after a delay.
|
code » | |||
onFailure()
Called when this delayed call is cancelled because the timeout has been
exceeded, and the listener has never returned
true.
Designed for inheritance, should be overridden by subclasses or on the
instances if they care.
|
code » | |||
onSuccess()
Called when the listener has been successfully executed and returned
true. The #isDone method should return true by now.
Designed for inheritance, should be overridden by subclasses or on the
instances if they care.
|
code » | |||
onTick_()
A callback function for the underlying
goog.async.Delay object. When
executed the listener function is called, and if it returns true
the delay is stopped and the #onSuccess method is invoked.
If the timeout is exceeded the delay is stopped and the
#onFailure method is called.
|
code » | |||
start(opt_interval, opt_timeout)
Starts the delay timer. The provided listener function will be called
repeatedly after the specified interval until the function returns
true or the timeout is exceeded. Calling start on an active timer
will stop the timer first.
Arguments:
|
code » | |||
stop()
Stops the delay timer if it is active. No action is taken if the timer is not
in use.
|
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 » |
|
The underlying goog.async.Delay delegate object.
|
Code » | |
|
The object context to invoke the callback in.
|
Code » | |
|
The delay interval in milliseconds to between the calls to the callback.
Note, that the callback may be invoked earlier than this interval if the
timeout is exceeded.
|
Code » | |
|
True if the listener has been executed, and it returned
true.
|
Code » | |
|
The timeout timestamp until which the delay is to be executed.
A negative value means no timeout.
|
Code » |