result.SimpleResult Extends
A SimpleResult object is a basic implementation of the goog.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).

Inheritance

Constructor

goog.result.SimpleResult()

Instance Methods

Public Protected Private
callHandlers_()
Calls the handlers registered for this Result.
code »
cancel() boolean
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.
code »
getError()
No description.
code »
getState()
No description.
code »
getValue()
No description.
code »
isCanceled()
No description.
code »
isPending_() boolean
No description.
Returns: boolean  Whether the Result is pending.
code »
setError(opt_error)
Sets the Result to be an error Result.
Arguments:
opt_error : *=
Optional error slug to set for this Result.
code »
setValue(value)
Sets the value of this Result, changing the state.
Arguments:
value : *
The value to set for this Result.
code »
then()
No description.
code »
wait(handleropt_scope)
Attaches handlers to be called when the value of this Result is available.
Arguments:
handler : !function(this:T, !goog.result.SimpleResult)
The function called when the value is available. The function is passed the Result object as the only argument.
opt_scope : T=
Optional scope for the handler.
code »

Instance Properties

error_ :
The error slug for this Result.
Code »
handlers_ :
The list of handlers to call when this Result is resolved.
Code »
state_ :
The current state of this Result.
Code »
value_ :
The 'value' of this Result.
Code »

Static Methods

goog.result.SimpleResult.fromPromise(promise) !goog.result.Result
Creates a SimpleResult that fires when the given promise resolves. Use only during migration to Promises.
Arguments:
promise : !goog.Promise.<?>
No description.
Returns: !goog.result.Result  No description.
code »

Static Properties

goog.result.SimpleResult.HandlerEntry_ :
A waiting handler entry.
Code »

Package result

Package Reference