當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


JavaScript ArcGIS WebMap.destroy用法及代碼示例

基本信息

以下是所在類或對象的基本信息。

AMD: require(["esri/WebMap"], (WebMap) => { /* code goes here */ });

ESM: import WebMap from "@arcgis/core/WebMap";

類: esri/WebMap

繼承: WebMap > Map > Accessor

自從:用於 JavaScript 4.0 的 ArcGIS API

用法說明

WebMap.destroy函數(或屬性)的定義如下:

destroy ()


自從:ArcGIS 適用於 JavaScript 4.17 的 API

銷毀 web Map以及任何關聯的資源,包括其圖層、底圖、地麵、表格和 PortalItem。一旦Map被破壞,這些就不能再使用。為了防止這些對象被破壞,請在調用 destroy() 之前將它們從 web Map中刪除。

// prevent the layers from being destroyed by removing them from the webmap
const layers = webmap.layers.removeAll();

// prevent the tables from being destroyed by removing them from the webmap
const tables = webmap.tables.removeAll();

// unset basemap from the webmap so that it is not destroyed
const basemap = webmap.basemap;
webmap.basemap = null;

// unset ground from the webmap so that it is not destroyed
const ground = webmap.ground;
webmap.ground = null;

// unset portalItem from the webmap so that it is not destroyed
const portalItem = webmap.portalItem;
webmap.portalItem = null;

// destroy the webmap and any remaining associated resources
webmap.destroy();

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 WebMap.destroy。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。