search

goog.async.ConditionalDelay

Provided By
Extends
All Implemented Interfaces

A ConditionalDelay object invokes the associated function after a specified interval delay and checks its return value. If the function returns 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.

new ConditionalDelay( listener, opt_handler )

Parameters
listenerfunction(): 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(Object|null)=

The object scope to invoke the function in.

Instance Methods

Instance Properties