new Future()
- Source:
Methods
cause() → {todo}
- Source:
Returns:
- Type
- todo
complete(result)
Parameters:
Name | Type | Description |
---|---|---|
result |
Object | the result |
- Source:
completer() → {function}
- Source:
Returns:
- Type
- function
compose(handler, next) → {Future}
next
future.
When this (the one on which compose
is called) future succeeds, the handler
will be called with
the completed value, this handler should complete the next future.
If the handler
throws an exception, the returned future will be failed with this exception.
When this future fails, the failure will be propagated to the next
future and the handler
will not be called.
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | the handler |
next |
Future | the next future |
- Source:
Returns:
- Type
- Future
fail(failureMessage)
Parameters:
Name | Type | Description |
---|---|---|
failureMessage |
string | the failure message |
- Source:
failed() → {boolean}
- Source:
Returns:
- Type
- boolean
isComplete() → {boolean}
It's completed if it's either succeeded or failed.
- Source:
Returns:
- Type
- boolean
map(value) → {Future}
value
.
When this future succeeds, this value
will complete the future returned by this method call.
When this future fails, the failure will be propagated to the returned future.
Parameters:
Name | Type | Description |
---|---|---|
value |
Object | the value that eventually completes the mapped future |
- Source:
Returns:
- Type
- Future
mapEmpty() → {Future}
null
.
This is a conveniency for future.map((T) null)
or future.map((Void) null)
.
When this future succeeds, null
will complete the future returned by this method call.
When this future fails, the failure will be propagated to the returned future.
- Source:
Returns:
- Type
- Future
otherwise(value) → {Future}
value
.
When this future fails, this value
will complete the future returned by this method call.
When this future succeeds, the result will be propagated to the returned future.
Parameters:
Name | Type | Description |
---|---|---|
value |
Object | the value that eventually completes the mapped future |
- Source:
Returns:
- Type
- Future
otherwiseEmpty() → {Future}
null
.
This is a convenience for future.otherwise((T) null)
.
When this future fails, the null
value will complete the future returned by this method call.
When this future succeeds, the result will be propagated to the returned future.
- Source:
Returns:
- Type
- Future
recover(mapper) → {Future}
Parameters:
Name | Type | Description |
---|---|---|
mapper |
todo | A function which takes the exception of a failure and returns a new future. |
- Source:
Returns:
- Type
- Future
result() → {Object}
- Source:
Returns:
- Type
- Object
setHandler(handler) → {Future}
If the future has already been completed it will be called immediately. Otherwise it will be called when the future is completed.
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | the Handler that will be called with the result |
- Source:
Returns:
- Type
- Future
succeeded() → {boolean}
- Source:
Returns:
- Type
- boolean
tryComplete(result) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
result |
Object | the result |
- Source:
Returns:
- Type
- boolean
tryFail(failureMessage) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
failureMessage |
string | the failure message |
- Source:
Returns:
- Type
- boolean