@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
25 lines (24 loc) • 1.07 kB
TypeScript
/**
* Provides a utility method for deeply cloning objects with properties that are computed or have their own `clone()` method, such as
* [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/).
*
* @since 4.0
*/
/**
* Use this method to deeply clone objects with properties that are computed or have their own `clone()` method.
* For example, if you are creating an object that stores an initial extent and a spatial reference
* for your application, you can use `esriLang.clone(initialProps)` to clone this object so that the `extent`
* and `spatialReference` are properly cloned.
*
* @param elem - The object to be cloned.
* @returns A clone of the object.
* @example
* const esriLang = await $arcgis.import("@arcgis/core/core/lang.js");
* let initialProps = {
* extent: appExtent, // app initial extent
* spatialReference: spatReference // app spatialReference
* };
* // Creates a deep clone of the object
* let clonedInitialProps = esriLang.clone(initialProps);
*/
export function clone<T>(elem: T): T;