- 自從:ArcGIS 適用於 JavaScript 4.19 的 API
一旦創建了類的實例,就可以利用
when()
。此方法采用兩個輸入參數:callback
函數和errback
函數。callback
在類實例加載時執行。errback
如果類的實例無法加載,則執行。參數:
類型 說明 callback Function可選的 當 promise 解決時調用的函數。
errback Function可選的 當 promise 失敗時執行的函數。
返回:
類型 說明 Promise 為 callback
的結果返回一個新的承諾,該承諾可用於 chain 附加函數。例子:
// Although this example uses the BasemapGallery widget, any class instance that is a promise may use when() in the same way let bmGallery = new BasemapGallery(); bmGallery.when(function(){ // This function will execute once the promise is resolved }, function(error){ // This function will execute if the promise is rejected due to an error });
基本信息
以下是所在類或對象的基本信息。
AMD:
require(["esri/widgets/Locate"], (Locate) => { /* code goes here */ });
ESM:
import Locate from "@arcgis/core/widgets/Locate";
類:
esri/widgets/Locate
繼承: Locate > Widget > Accessor
自從:用於 JavaScript 4.0 的 ArcGIS API
用法說明
Locate.when
函數(或屬性)的定義如下:
相關用法
- JavaScript ArcGIS Locate.locate用法及代碼示例
- JavaScript ArcGIS Locate.visible用法及代碼示例
- JavaScript ArcGIS Locate.container用法及代碼示例
- JavaScript ArcGIS Locate.scale用法及代碼示例
- JavaScript ArcGIS Locate.on用法及代碼示例
- JavaScript ArcGIS Locate.goToOverride用法及代碼示例
- JavaScript ArcGIS Locate.classes用法及代碼示例
- JavaScript ArcGIS Locate.graphic用法及代碼示例
- JavaScript ArcGIS Locate用法及代碼示例
- JavaScript ArcGIS Locator.addressesToLocations用法及代碼示例
- JavaScript ArcGIS Locator.addressToLocations用法及代碼示例
- JavaScript ArcGIS LabelClass.repeatLabelDistance用法及代碼示例
- JavaScript ArcGIS LineOfSight.on用法及代碼示例
- JavaScript ArcGIS LineOfSight.classes用法及代碼示例
- JavaScript ArcGIS LabelSymbol3D.callout用法及代碼示例
- JavaScript ArcGIS Layer.opacity用法及代碼示例
- JavaScript ArcGIS Legend.classes用法及代碼示例
- JavaScript ArcGIS LabelSymbol3D.verticalOffset用法及代碼示例
- JavaScript ArcGIS LayerList.classes用法及代碼示例
- JavaScript ArcGIS Legend用法及代碼示例
- JavaScript ArcGIS LineSymbol3DLayer.size用法及代碼示例
- JavaScript ArcGIS LabelSymbol3D用法及代碼示例
- JavaScript ArcGIS LineOfSightAnalysis用法及代碼示例
- JavaScript ArcGIS Legend.style用法及代碼示例
- JavaScript ArcGIS LineOfSightAnalysisView3D用法及代碼示例
注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 Locate.when。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。