▾
import BasemapGalleryModel from "@arcgis/core/basemapGallery/BasemapGalleryModel.js";const BasemapGalleryModel = await $arcgis.import("@arcgis/core/basemapGallery/BasemapGalleryModel.js");- Inheritance
- BasemapGalleryModel→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Provides the logic for displaying and selecting a collection of basemaps.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| | ||
| readonly | | |
| | ||
| readonly inherited | ||
| readonly | | |
| readonly inherited | ||
| readonly | | |
| readonly inherited | "not-loaded" | "loading" | "failed" | "loaded" | |
| readonly inherited | any[] | |
| | ||
| |
compatibilityFunction
Function used to determine whether a basemap is compatible with the current view. This is mostly needed for SceneView.
loadError
The Error object returned if an error occurred while loading.
loading
- Type
- boolean
Indicates whether any basemap item in the collection is loading.
- Default value
- false
loadStatus
- Type
- "not-loaded" | "loading" | "failed" | "loaded"
Represents the status of a load() operation.
| Value | Description |
|---|---|
| not-loaded | The object's resources have not loaded. |
| loading | The object's resources are currently loading. |
| loaded | The object's resources have loaded without errors. |
| failed | The object's resources failed to load. See loadError for more details. |
- Default value
- "not-loaded"
loadWarnings
- Type
- any[]
A list of warnings which occurred while loading.
source
The source for basemaps that the gallery will display. This property can be autocast with an array or Collection of Basemaps, or a Portal instance. The default source is a PortalBasemapsSource.
view
- Type
- MapViewOrSceneView | null | undefined
The view from which the Basemap Gallery will operate. This view provides access to the active Map.basemap through the view's View.map property.
Methods
| Method | Signature | Class |
|---|---|---|
| basemapEquals(basemap1: Basemap | null | undefined, basemap2: Basemap | null | undefined): boolean | | |
| inherited | cancelLoad(): this | |
| destroy(): void | | |
| inherited | isFulfilled(): boolean | |
| inherited | isRejected(): boolean | |
| inherited | isResolved(): boolean | |
| load(): Promise<this> | | |
| refresh(): void | | |
| inherited | when<TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2> |
cancelLoad
- Signature
-
cancelLoad (): this
Cancels a load() operation if it is already in progress.
- Returns
- this
isFulfilled
- Signature
-
isFulfilled (): boolean
isFulfilled() may be used to verify whether the promise has been fulfilled (either resolved or rejected).
- Returns
- boolean
Whether the promise has been fulfilled (either resolved or rejected).
isRejected
- Signature
-
isRejected (): boolean
isRejected() may be used to verify whether the promise has been rejected.
- Returns
- boolean
Whether the promise has been rejected.
isResolved
- Signature
-
isResolved (): boolean
isResolved() may be used to verify whether the promise has resolved.
- Returns
- boolean
Whether the promise has resolved.
when
- Signature
-
when <TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>
- Since
- ArcGIS Maps SDK for JavaScript 4.6
when() may be used with an instance of this class. This method takes two input parameters: an onFulfilled function and an onRejected function.
The onFulfilled function executes when the promise resolves. The
onRejected function executes if the promise is rejected.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| onFulfilled | OnFulfilledCallback<this, TResult1> | null | undefined | The function to call when the promise resolves. | |
| onRejected | The function to execute when the promise fails. | |
- Returns
- Promise<TResult1 | TResult2>
Returns a new promise for the result of
onFulfilledthat may be used to chain additional functions.
- Example
- // Although this example uses MapView, any class instance that is a promise may use when() in the same waylet view = new MapView();view.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});