Interface IItemPromise

Provides a mechanism for retrieving IItem objects asynchronously.

Index

Properties

Methods

Properties

public handle: string

Gets or sets the temporary ID of the IItem that fulfills this promise.

public index: number

Gets or sets the index of the IItem contained by this IItemPromise.

Methods

public cancel()

Attempts to cancel the fulfillment of a promised value. If the promise hasn't already been fulfilled and cancellation is supported, the promise enters the error state with a value of Error("Canceled").

public done(onComplete: (item: T) => void, onError?: (error: Error) => void, onProgress?: (progressData: any) => void)

Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way. After the handlers have finished executing, this function throws any error that would have been returned from then as a promise in the error state.

Parameters

  • onComplete: (item: T) => void

    The function to be called if the promise is fulfilled successfully with a value. The fulfilled value is passed as the single argument. If the value is null, the fulfilled value is returned. The value returned from the function becomes the fulfilled value of the promise returned by then. If an exception is thrown while executing the function, the promise returned by then moves into the error state.

  • onError?: (error: Error) => void optional

    The function to be called if the promise is fulfilled with an error. The error is passed as the single argument. If it is null, the error is forwarded. The value returned from the function is the fulfilled value of the promise returned by then.

  • onProgress?: (progressData: any) => void optional

    The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress.

public onerror(eventInfo: CustomEvent)

Occurs when there is an error in processing.

Parameters

  • eventInfo: CustomEvent

    An object that contains information about the event.

public release()

Stops change notification tracking for the IItem that fulfills this IItemPromise.

public retain()

Begins change notification tracking for the IItem that fulfills this IItemPromise.

public then(onComplete: (item: T) => void, onError?: (error: Error) => void, onProgress?: (progressData: any) => void): IItemPromise

Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way.

Parameters

  • onComplete: (item: T) => void

    The function to be called if the promise is fulfilled successfully with a value. The value is passed as the single argument. If the value is null, the value is returned. The value returned from the function becomes the fulfilled value of the promise returned by then. If an exception is thrown while this function is being executed, the promise returned by then moves into the error state.

  • onError?: (error: Error) => void optional

    The function to be called if the promise is fulfilled with an error. The error is passed as the single argument. If it is null, the error is forwarded. The value returned from the function becomes the fulfilled value of the promise returned by then.

  • onProgress?: (progressData: any) => void optional

    The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress.

Returns

IItemPromise

The promise whose value is the result of executing the complete or error function.