-
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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。