The goog.labs.result.SimpleResult Class

goog.labs.result.SimpleResult()

A SimpleResult object is a basic implementation of the goog.labs.result.Result interface. This could be subclassed(e.g. XHRResult) or instantiated and returned by another class as a form of result. The caller receiving the result could then attach handlers to be called when the result is resolved(success or error).

The goog.labs.result.SimpleResult.StateError Class

Error thrown if there is an attempt to set the value or error for this result more than once. … more

.cancel()

Cancels the Result.

returns {boolean}
Whether the result was canceled. It will not be canceled if the result was already canceled or has already resolved.

.getError()

.getState()

.getValue()

.isCanceled()

.setError(opt_error)

Sets the Result to be an error Result.

opt_error {*=}
Optional error slug to set for this Result.

.setValue(value)

Sets the value of this Result, changing the state.

value {*}
The value to set for this Result.

.wait(handler)

Attaches handlers to be called when the value of this Result is available.

handler {!function(!goog.labs.result.SimpleResult)}
The function called when the value is available. The function is passed the Result object as the only argument.