/ fm / liveswitch / Promise
Class: Promise<T>
fm.liveswitch.Promise
Type parameters
| Name | 
|---|
| T | 
Hierarchy
- PromiseBase<T> - ↳ Promise 
Table of contents
Constructors
Methods
- castAndResolve
- doAll
- doAny
- fail
- getException
- getId
- getResult
- getState
- getTypeString
- process
- reject
- rejectAsync
- resolve
- resolveAsync
- setException
- setResult
- setState
- then
- all
- any
- delay
- rejectNow
- resolveNow
- wrap
- wrapAsync
- wrapPromise
Constructors
constructor
+ new Promise<T>(): Promise<T>
Initializes a new instance of the [[fm.liveswitch.promiseBase]] class.
Type parameters:
| Name | 
|---|
| T | 
Returns: Promise<T>
Inherited from: PromiseBase
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
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:218
doAll
▸ ProtecteddoAll<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
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:230
doAny
▸ ProtecteddoAny<R>(promises: Future<R>[], resolveCount: AtomicInteger, rejectCounter: AtomicInteger): void
Internal DoAny.
Type parameters:
| Name | Type | 
|---|---|
| R | Object | 
Parameters:
| Name | Type | 
|---|---|
| promises | Future<R>[] | 
| resolveCount | AtomicInteger | 
| rejectCounter | AtomicInteger | 
Returns: void
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:261
fail
▸ fail(reject?: IAction1<Exception>): Future<T>
Parameters:
| Name | Type | 
|---|---|
| reject? | IAction1<Exception> | 
Returns: Future<T>
Overrides: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/Promise.ts:33
getException
▸ getException(): Exception
Gets the exception if rejected.
Returns: Exception
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:35
getId
▸ getId(): string
Gets the identifier of this promise.
Returns: string
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:319
getResult
▸ getResult(): T
Gets the result if resolved.
Returns: T
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:47
getState
▸ getState(): FutureState
Gets the current state.
Returns: FutureState
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:59
getTypeString
▸ getTypeString(): string
Returns: string
Overrides: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/Promise.ts:5
process
▸ Protectedprocess(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
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:334
reject
▸ reject(exception: Exception): boolean
Rejects the promise.
Parameters:
| Name | Type | Description | 
|---|---|---|
| exception | Exception | The exception. | 
Returns: boolean
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:412
rejectAsync
▸ rejectAsync(exception: Exception): Future<Object>
Rejects the promise asynchronously.
Parameters:
| Name | Type | Description | 
|---|---|---|
| exception | Exception | The exception. | 
Returns: Future<Object>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:431
resolve
▸ resolve(result: T): boolean
Resolves the promise.
Parameters:
| Name | Type | Description | 
|---|---|---|
| result | T | The result. | 
Returns: boolean
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:457
resolveAsync
▸ resolveAsync(result: T): Future<Object>
Resolves the promise asynchronously.
Parameters:
| Name | Type | Description | 
|---|---|---|
| result | T | The result. | 
Returns: Future<Object>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:476
setException
▸ ProtectedsetException(value: Exception): void
Sets the exception if rejected.
Parameters:
| Name | Type | 
|---|---|
| value | Exception | 
Returns: void
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:71
setResult
▸ ProtectedsetResult(value: T): void
Sets the result if resolved.
Parameters:
| Name | Type | 
|---|---|
| value | T | 
Returns: void
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:83
setState
▸ ProtectedsetState(value: FutureState): void
Sets the current state.
Parameters:
| Name | Type | 
|---|---|
| value | FutureState | 
Returns: void
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/FutureBase.ts:95
then
▸ then<R>(resolve: IFunction1<T, R | Future<R>>, reject?: IAction1<Exception>): Future<R>
Type parameters:
| Name | 
|---|
| R | 
Parameters:
| Name | Type | 
|---|---|
| resolve | IFunction1<T, R | Future<R>> | 
| reject? | IAction1<Exception> | 
Returns: Future<R>
Overrides: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/Promise.ts:8
all
▸ Staticall<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>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:55
any
▸ Staticany<R>(promises: Future<R>[]): Future<R>
Returns a promise that resolves when any passed in promise resolves.
Type parameters:
| Name | Type | 
|---|---|
| R | Object | 
Parameters:
| Name | Type | Description | 
|---|---|---|
| promises | Future<R>[] | The promises to check. | 
Returns: Future<R>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:75
delay
▸ Staticdelay<R>(delayMs: number): Future<R>
Create a promise that resolves afer a delay.
Type parameters:
| Name | Type | 
|---|---|
| R | Object | 
Parameters:
| Name | Type | 
|---|---|
| delayMs | number | 
Returns: Future<R>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:96
rejectNow
▸ StaticrejectNow<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>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:123
resolveNow
▸ StaticresolveNow(): Future<Object>
Creates a promise and resolves it immediately using a null result value.
Returns: Future<Object>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:138
▸ StaticresolveNow<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>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:146
wrap
▸ Staticwrap(callbackAction: IAction0): Future<Object>
Parameters:
| Name | Type | 
|---|---|
| callbackAction | IAction0 | 
Returns: Future<Object>
Defined in: Generated/TypeScript/fm.liveswitch/Promise.ts:45
▸ Staticwrap<R>(callbackFunction: IFunction0<R>): Future<R>
Type parameters:
| Name | Type | 
|---|---|
| R | Object | 
Parameters:
| Name | Type | 
|---|---|
| callbackFunction | IFunction0<R> | 
Returns: Future<R>
Defined in: Generated/TypeScript/fm.liveswitch/Promise.ts:46
wrapAsync
▸ StaticwrapAsync(callbackAction: IAction0): Future<Object>
Parameters:
| Name | Type | 
|---|---|
| callbackAction | IAction0 | 
Returns: Future<Object>
Defined in: Generated/TypeScript/fm.liveswitch/Promise.ts:65
▸ StaticwrapAsync<R>(callbackFunction: IFunction0<R>): Future<R>
Type parameters:
| Name | Type | 
|---|---|
| R | Object | 
Parameters:
| Name | Type | 
|---|---|
| callbackFunction | IFunction0<R> | 
Returns: Future<R>
Defined in: Generated/TypeScript/fm.liveswitch/Promise.ts:66
wrapPromise
▸ StaticwrapPromise<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>
Inherited from: PromiseBase
Defined in: Generated/TypeScript/fm.liveswitch/PromiseBase.ts:166