import PortalBasemapsSource from "@arcgis/core/basemapGallery/PortalBasemapsSource.js";
Inheritance
PortalBasemapsSource→LocalBasemapsSource→BasemapsSource→Accessor
Since
ArcGIS Maps SDK for JavaScript 5.2

A Portal-driven source for Basemaps in a BasemapGalleryModel.

See also

Constructors

Constructor

Constructor

Parameters

ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
readonly
readonly inherited
readonly inherited
readonly inherited
"not-loaded" | "loading" | "failed" | "loaded"
readonly inherited
any[]
readonly

basemaps

readonly Property
Type
Collection<Basemap>

A collection of Basemaps fetched from the source's Portal.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

filterFunction

Property
Type
BasemapFilter | null | undefined

Function used to filter basemaps after being fetched from the Portal.

loadError

readonlyinherited Property
Type
EsriError | null | undefined
Inherited from: LoadableMixin

The Error object returned if an error occurred while loading.

loadStatus

readonlyinherited Property
Type
"not-loaded" | "loading" | "failed" | "loaded"
Inherited from: LoadableMixin

Represents the status of a load() operation.

ValueDescription
not-loadedThe object's resources have not loaded.
loadingThe object's resources are currently loading.
loadedThe object's resources have loaded without errors.
failedThe object's resources failed to load. See loadError for more details.
Default value
"not-loaded"

loadWarnings

readonlyinherited Property
Type
any[]
Inherited from: LoadableMixin

A list of warnings which occurred while loading.

portal

autocast Property
Type
Portal

The Portal from which to fetch basemaps.

query

Property
Type
Record<string, any> | string | null | undefined

An object with key-value pairs used to create a custom basemap gallery group query. Note that all parameters will be joined using the AND operator. A query string can also be provided for more advanced use cases.

state

readonly Property
Type
BasemapsSourceState

The source's state.

Default value
"not-loaded"

updateBasemapsCallback

Property
Type
UpdateBasemapsCallback | null | undefined

Callback for updating basemaps after being fetched and filtered.

Methods

MethodSignatureClass
inherited
cancelLoad(): this
destroy(): void
inherited
isFulfilled(): boolean
inherited
isRejected(): boolean
inherited
isResolved(): boolean
load(options?: AbortOptions | null | undefined): Promise<this>
refresh(): Promise<void>
inherited
when<TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>

cancelLoad

inherited Method
Signature
cancelLoad (): this
Inherited from: LoadableMixin

Cancels a load() operation if it is already in progress.

Returns
this

destroy

Method
Signature
destroy (): void

Destroys the Portal basemaps source.

Returns
void

isFulfilled

inherited Method
Signature
isFulfilled (): boolean
Inherited from: EsriPromiseMixin

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

inherited Method
Signature
isRejected (): boolean
Inherited from: EsriPromiseMixin

isRejected() may be used to verify whether the promise has been rejected.

Returns
boolean

Whether the promise has been rejected.

isResolved

inherited Method
Signature
isResolved (): boolean
Inherited from: EsriPromiseMixin

isResolved() may be used to verify whether the promise has resolved.

Returns
boolean

Whether the promise has resolved.

load

Method
Signature
load (options?: AbortOptions | null | undefined): Promise<this>

Loads the source's Portal.

Parameters

ParameterTypeDescriptionRequired
options

Options for aborting the load.

Returns
Promise<this>

A promise that resolves with this source when the Portal has loaded.

refresh

Method
Signature
refresh (): Promise<void>

Refreshes basemaps by fetching them from the Portal.

Returns
Promise<void>

A promise that resolves when the basemaps have been fetched.

when

inherited Method
Signature
when <TResult1 = this, TResult2 = never>(onFulfilled?: OnFulfilledCallback<this, TResult1> | null | undefined, onRejected?: OnRejectedCallback<TResult2> | null | undefined): Promise<TResult1 | TResult2>
Type parameters
<TResult1 = this, TResult2 = never>
Inherited from: EsriPromiseMixin
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

ParameterTypeDescriptionRequired
onFulfilled

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 onFulfilled that 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 way
let 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
});