@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
56 lines (53 loc) • 2.95 kB
TypeScript
import type EsriError from "./Error.js";
import type { EsriPromise } from "./Promise.js";
import type { AbortOptions } from "./promiseUtils.js";
export interface LoadableMixinProperties {}
/**
* Loadable is a mixin class that provides a standardized way to load resources
* asynchronously. Many classes in the API that load resources from a remote
* source extend this class.
*
* @since 4.0
*/
export abstract class LoadableMixin {
constructor(...args: any[]);
/** The Error object returned if an error occurred while loading. */
get loadError(): EsriError | null | undefined;
/**
* Represents the status of a [load()](https://developers.arcgis.com/javascript/latest/references/core/core/Loadable/#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](https://developers.arcgis.com/javascript/latest/references/core/core/Loadable/#loadError) for more details.
*
* @default "not-loaded"
*/
get loadStatus(): "not-loaded" | "loading" | "failed" | "loaded";
/** A list of warnings which occurred while loading. */
get loadWarnings(): any[];
/** Cancels a [load()](https://developers.arcgis.com/javascript/latest/references/core/core/Loadable/#load) operation if it is already in progress. */
cancelLoad(): this;
/**
* Loads the resources referenced by this class. This method automatically
* executes for a [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) and all of the resources
* it references in [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/) if the view is constructed with
* a map instance.
*
* This method must be called by the developer when accessing a resource that will not be
* loaded in a [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/).
*
* The `load()` method only triggers the loading of the resource the first time it is called. The subsequent calls return the same promise.
*
* It's possible to provide a `signal` to stop being interested into a `Loadable` instance load status.
* When the signal is aborted, the instance does not stop its loading process, only [cancelLoad()](https://developers.arcgis.com/javascript/latest/references/core/core/Loadable/#cancelLoad) can abort it.
*
* @param options - Additional options.
* @returns Resolves when the resources have [loaded](https://developers.arcgis.com/javascript/latest/references/core/core/Loadable/#loadStatus).
*/
load(options?: AbortOptions | null | undefined): Promise<this>;
}
export abstract class Loadable extends LoadableSuperclass {}
declare const LoadableSuperclass: & typeof EsriPromise & typeof LoadableMixin