/ fm / liveswitch / PromiseBase
Class: PromiseBase<T>
fm.liveswitch.PromiseBase
Promise base properties/methods.
Type parameters
Name |
---|
T |
Hierarchy
Implements
Table of contents
Constructors
Methods
- castAndResolve
- doAll
- fail
- getException
- getId
- getResult
- getState
- getTypeString
- process
- reject
- rejectAsync
- resolve
- resolveAsync
- setException
- setResult
- setState
- then
- all
- rejectNow
- resolveNow
- wrapPromise
Constructors
constructor
+ new PromiseBase<T>(): PromiseBase<T>
Initializes a new instance of the [[fm.liveswitch.promiseBase]] class.
Type parameters:
Name |
---|
T |
Returns: PromiseBase<T>
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:24
Methods
castAndResolve
▸ castAndResolve(result
: Object): boolean
Casts the result and resolves the promise. Will throw an exception if the cast fails.
Parameters:
Name | Type | Description |
---|---|---|
result |
Object | The result. |
Returns: boolean
Implementation of: IPromise
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:170
doAll
▸ Protected
doAll<R>(promises
: Future<R>[], counter
: AtomicInteger): void
Internal DoAll.
Type parameters:
Name | Type |
---|---|
R |
Object |
Parameters:
Name | Type |
---|---|
promises |
Future<R>[] |
counter |
AtomicInteger |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:182
fail
▸ Abstract
fail(rejectAction
: IAction1<Exception>): Future<T>
Parameters:
Name | Type |
---|---|
rejectAction |
IAction1<Exception> |
Returns: Future<T>
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/Future.ts:7
getException
▸ getException(): Exception
Gets the exception if rejected.
Returns: Exception
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:35
getId
▸ getId(): string
Gets the identifier of this promise.
Returns: string
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:238
getResult
▸ getResult(): T
Gets the result if resolved.
Returns: T
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:47
getState
▸ getState(): FutureState
Gets the current state.
Returns: FutureState
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:59
getTypeString
▸ getTypeString(): string
Returns: string
Overrides: Future
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:10
process
▸ Protected
process(promise
: IPromise, resolve
: IAction1<T>, reject
: IAction1<Exception>): void
Processes the specified promise.
Parameters:
Name | Type | Description |
---|---|---|
promise |
IPromise | The promise. |
resolve |
IAction1<T> | The resolve. |
reject |
IAction1<Exception> | The reject. |
Returns: void
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:253
reject
▸ reject(exception
: Exception): boolean
Rejects the promise.
Parameters:
Name | Type | Description |
---|---|---|
exception |
Exception | The exception. |
Returns: boolean
Implementation of: IPromise
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:331
rejectAsync
▸ rejectAsync(exception
: Exception): Future<Object>
Rejects the promise asynchronously.
Parameters:
Name | Type | Description |
---|---|---|
exception |
Exception | The exception. |
Returns: Future<Object>
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:350
resolve
▸ resolve(result
: T): boolean
Resolves the promise.
Parameters:
Name | Type | Description |
---|---|---|
result |
T | The result. |
Returns: boolean
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:376
resolveAsync
▸ resolveAsync(result
: T): Future<Object>
Resolves the promise asynchronously.
Parameters:
Name | Type | Description |
---|---|---|
result |
T | The result. |
Returns: Future<Object>
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:395
setException
▸ Protected
setException(value
: Exception): void
Sets the exception if rejected.
Parameters:
Name | Type |
---|---|
value |
Exception |
Returns: void
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:71
setResult
▸ Protected
setResult(value
: T): void
Sets the result if resolved.
Parameters:
Name | Type |
---|---|
value |
T |
Returns: void
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:83
setState
▸ Protected
setState(value
: FutureState): void
Sets the current state.
Parameters:
Name | Type |
---|---|
value |
FutureState |
Returns: void
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:95
then
▸ Abstract
then<R>(resolve
: IAction1<T> | IFunction1<T, Future<R>>): Future<R>
Type parameters:
Name |
---|
R |
Parameters:
Name | Type |
---|---|
resolve |
IAction1<T> | IFunction1<T, Future<R>> |
Returns: Future<R>
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/Future.ts:8
▸ Abstract
then<R>(resolve
: IAction1<T> | IFunction1<T, Future<R>>, reject
: IAction1<Exception>): Future<R>
Type parameters:
Name |
---|
R |
Parameters:
Name | Type |
---|---|
resolve |
IAction1<T> | IFunction1<T, Future<R>> |
reject |
IAction1<Exception> |
Returns: Future<R>
Inherited from: Future
Defined in: Generated/TypeScript/fm.liveswitch/Future.ts:9
all
▸ Static
all<R>(promises
: Future<R>[]): Future<R>
Returns a promise that resolves when all passed in promises resolve.
Type parameters:
Name | Type |
---|---|
R |
Object |
Parameters:
Name | Type | Description |
---|---|---|
promises |
Future<R>[] | The promises to check. |
Returns: Future<R>
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:55
rejectNow
▸ Static
rejectNow<R>(ex
: Exception): Future<R>
Creates a promise and rejects it immediately.
Type parameters:
Name | Type |
---|---|
R |
Object |
Parameters:
Name | Type | Description |
---|---|---|
ex |
Exception | The exception. |
Returns: Future<R>
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:75
resolveNow
▸ Static
resolveNow(): Future<Object>
Creates a promise and resolves it immediately using a null result value.
Returns: Future<Object>
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:90
▸ Static
resolveNow<R>(result
: R): Future<R>
Creates a promise and resolves it immediately using the given result value.
Type parameters:
Name | Type |
---|---|
R |
Object |
Parameters:
Name | Type | Description |
---|---|---|
result |
R | The result. |
Returns: Future<R>
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:98
wrapPromise
▸ Static
wrapPromise<R>(callback
: IFunction0<Future<R>>): Future<R>
Creates a promise and resolves it using the result from a callback function, or rejects it if an exception is thrown.
Type parameters:
Name | Type |
---|---|
R |
Object |
Parameters:
Name | Type | Description |
---|---|---|
callback |
IFunction0<Future<R>> | The callback function. |
Returns: Future<R>
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:118