-
createAbortError
()
{Error}
创建一个特殊的错误对象,用于在承诺链中发出中止请求的信号。由于abort signals 而被拒绝的 Promise 应该以这种错误被拒绝。
返回:
类型 说明 Error 一个特殊的错误对象,表示一个中止的请求。 例子:
// Request multiple files and return results in an array function requestMultiple(urls, abortSignal) { // Fire off requests let promises = urls.map(url => request(url, { signal: abortSignal }); // Wait until all requests have either resolved or rejected promiseUtils.eachAlways(urls) .then(results => { if (abortSignal && abortSignal.aborted) { // If the user has triggered the abortSignal, all requests will react and reject. eachAlways resolves with // an array that contains the reject error for each request. Instead of returning this array as a result, we // should reject the promise returned to the user with an abort error. throw promiseUtils.createAbortError(); } return results; }); }
基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/core/promiseUtils"], (promiseUtils) => { /* code goes here */ });
ESM:
import * as promiseUtils from "@arcgis/core/core/promiseUtils";
对象:
esri/core/promiseUtils
自从:用于 JavaScript 4.2 的 ArcGIS API
用法说明
promiseUtils.createAbortError
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS promiseUtils.create用法及代码示例
- JavaScript ArcGIS promiseUtils.eachAlways用法及代码示例
- JavaScript ArcGIS promiseUtils.isAbortError用法及代码示例
- JavaScript ArcGIS promiseUtils.debounce用法及代码示例
- JavaScript ArcGIS promiseUtils.resolve用法及代码示例
- JavaScript ArcGIS promiseUtils.reject用法及代码示例
- JavaScript promise reject()用法及代码示例
- JavaScript ArcGIS projection.load用法及代码示例
- JavaScript ArcGIS projection.getTransformations用法及代码示例
- JavaScript ArcGIS projection.project用法及代码示例
- JavaScript ArcGIS predominance.createRenderer用法及代码示例
- JavaScript ArcGIS print.execute用法及代码示例
- JavaScript ArcGIS predominantCategories.predominantCategories用法及代码示例
- JavaScript ArcGIS predominance.getSchemeByName用法及代码示例
- JavaScript ArcGIS predominanceUtils.getPredominanceExpressions用法及代码示例
- JavaScript ArcGIS predominance.cloneScheme用法及代码示例
- JavaScript ArcGIS predominance.getSchemes用法及代码示例
- JavaScript ArcGIS predominance.getSchemesByTag用法及代码示例
- JavaScript parseInt()用法及代码示例
- JavaScript parseFloat()用法及代码示例
- JavaScript performance.now()用法及代码示例
- JavaScript ArcGIS SceneView double-click事件用法及代码示例
- JavaScript ArcGIS geometryEngineAsync.overlaps用法及代码示例
- JavaScript ArcGIS Expand.when用法及代码示例
- JavaScript ArcGIS Sublayer.JoinTableDataSource用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 promiseUtils.createAbortError。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。