Usage
Signature:
interface AbortReason extends DOMException
Typescript Import Format
//To use this interface, import as below.
import {AbortReason} from "ojs/ojabortreason";
For additional information visit:
The AbortReason interface defines the exception contract that will be provided when JET components abort fetch requests.
Example
// abort on an AbortController instance will abort all requests that are associated
// with the signal from that abortController.
const abortController = new AbortController();
let keySet = new Set();
keySet.add(1001);
keySet.add(556);
// component passes AbortSignal as part of FetchByKeysParameters to fetchByKeys
// on dataProvider
try {
let value = await dataprovider.fetchByKeys({keys: keySet, signal: abortController.signal});
} catch (err) {
// if the data fetch has been aborted, retrieving data from the fetched result
// will be rejected with DOMException named AbortError
if (err.severity === 'info') {
// if the data fetch has been aborted from a jet component as a performance concern, an AbortReason will be provided.
console.log(err.message);
}
}
// later when abort is desired, component can invoke abort() on the cached
// abort controller to abort any outstanding data retrieval it requested
// on asyncIterator.
if (abort_is_desired) {
abortController.abort();
}