# Class InitializableBase<TProperties>`Abstract`

A base class that contains logic for initializing items.

#### Type Parameters

- TProperties extends InitializableBaseProperties = InitializableBaseProperties

#### Hierarchy (view full)

- SerializableBase<InitializableBaseProperties, this> & ObservableMixin<this>
  - InitializableBase
    - EntityBase
    - IdentifyService
    - QueryService
    - SearchService

#### Implements

- Initializable

#####
Index

### Constructors

constructor

### Properties

@eventTypes

### Accessors

failureMode
isDestroyed
isInitialized

### Methods

_getSerializableProperties
_initializableChildCollections
_initializeChildren
_onDestroy
_onInitialize
_postInitialize
_toPropertyDef
assignProperties
assignPropertiesAsync
destroy
finishAssignProperties
getDefault
getDefaults
getSerializableProperties
initialize
toJSON

##
Constructors

### constructor

- new InitializableBase<TProperties>(_properties?): InitializableBase<TProperties>

- #### Type Parameters

  - TProperties extends InitializableBaseProperties = InitializableBaseProperties

  #### Parameters

  - `Optional`_properties: InitializableBaseProperties

  #### Returns InitializableBase<TProperties>

  Inherited from observable(SerializableBase<InitializableBaseProperties>).constructor

##
Properties

### @eventTypes

@eventTypes: InitializableBaseEvents

#### Deprecated

Do not directly reference this property. Use EventNames and EventTypes helpers from @arcgis/core/Evented.

Overrides observable(SerializableBase<InitializableBaseProperties>).@eventTypes

##
Accessors

### failureMode

- get failureMode(): FailureMode

- Determines how a parent object should handle initialization failure in this object. The default is "warn".

  - `"error"`: support/InitializeError!InitializeError is thrown.
  - `"warn"`: Message is logged and support/InitializableBase!InitializeWarningEvent is raised.
  - `"ignore"`: support/InitializableBase!InitializeWarningEvent is raised.

  #### Returns FailureMode

- set failureMode(value): void

- #### Parameters

  - value: FailureMode

  #### Returns void

### isDestroyed

- get isDestroyed(): boolean

- See support/InitializableBase!Initializable.isDestroyed.

  #### Returns boolean

  Implementation of Initializable.isDestroyed

### isInitialized

- get isInitialized(): boolean

- See support/InitializableBase!Initializable.isInitialized.

  #### Returns boolean

  Implementation of Initializable.isInitialized

##
Methods

### `Protected`_getSerializableProperties

- _getSerializableProperties(): PropertyDefs<TProperties>

- The property keys and their metadata that are used to implement serializing and deserializing the class instance.

  #### Returns PropertyDefs<TProperties>

  Overrides observable(SerializableBase<InitializableBaseProperties>)._getSerializableProperties

### `Protected`_initializableChildCollections

- _initializableChildCollections(): IterableIterator<Collection<InitializableBase<InitializableBaseProperties>>, any, any>

- Collections of child items to initialize. Items that fail to initialize are removed from the collection.

  #### Returns IterableIterator<Collection<InitializableBase<InitializableBaseProperties>>, any, any>

### `Protected`_initializeChildren

- _initializeChildren(): Promise<void>

- Initializes child entities.

  #### Returns Promise<void>

### `Protected`_onDestroy

- _onDestroy(): Promise<void>

- Called to perform cleanup. Subclasses should override this method rather than destroy() to perform custom cleanup.

  #### Returns Promise<void>

### `Protected`_onInitialize

- _onInitialize(): Promise<void>

- Called to perform initialization of the support/InitializableBase!InitializableBase. Subclasses should override this method rather than initialize() to perform custom initialization.

  #### Returns Promise<void>

### `Protected`_postInitialize

- _postInitialize(): Promise<void>

- Called after normal initialization. Note: Child items are initialized before this is called.

  #### Returns Promise<void>

### `Protected`_toPropertyDef

- _toPropertyDef<T>(def): PropertyDef<T>

- Converts the value to a PropertyDef object.

  #### Type Parameters

  - T

  #### Parameters

  - def: PropertyDefSerializeMode | PropertyDefSerializeMode[] | PropertyDef<T>

    The value to convert.

  #### Returns PropertyDef<T>

  Inherited from observable(SerializableBase<InitializableBaseProperties>)._toPropertyDef

### assignProperties

- assignProperties(properties): void

- #### Parameters

  - properties: Partial<TProperties>

  #### Returns void

  #### Inherit Doc

  Overrides observable(SerializableBase<InitializableBaseProperties>).assignProperties

### assignPropertiesAsync

- assignPropertiesAsync(properties): Promise<void>

- #### Parameters

  - properties: Partial<TProperties>

  #### Returns Promise<void>

  #### Inherit Doc

  Overrides observable(SerializableBase<InitializableBaseProperties>).assignPropertiesAsync

### destroy

- destroy(): Promise<void>

- A clean-up function that should get called whenever the item is disposed of.

  #### Returns Promise<void>

  Implementation of Initializable.destroy

### finishAssignProperties

- finishAssignProperties(): Promise<void>

- #### Returns Promise<void>

  #### Inherit Doc

  Inherited from observable(SerializableBase<InitializableBaseProperties>).finishAssignProperties

### getDefault

- getDefault<K>(key): TProperties[K]

- #### Type Parameters

  - K extends string | number | symbol

  #### Parameters

  - key: K

  #### Returns TProperties[K]

  #### Inherit Doc

  Overrides observable(SerializableBase<InitializableBaseProperties>).getDefault

### getDefaults

- getDefaults(): TProperties

- #### Returns TProperties

  #### Inherit Doc

  Overrides observable(SerializableBase<InitializableBaseProperties>).getDefaults

### getSerializableProperties

- getSerializableProperties(serializeMode?): PropertyDefs<TProperties>

- Returns the serializable properties.

  #### Parameters

  - `Optional` serializeMode: SerializeMode

    Optional. If specified, only properties that support the given serialization mode will be returned.

  #### Returns PropertyDefs<TProperties>

  Overrides observable(SerializableBase<InitializableBaseProperties>).getSerializableProperties

### initialize

- initialize(): Promise<void>

- Initializes the item.

  #### Returns Promise<void>

  Implementation of Initializable.initialize

### toJSON

- toJSON(serializeMode?): TProperties

- #### Parameters

  - serializeMode: SerializeMode = "all"

  #### Returns TProperties

  #### Inherit Doc

  Overrides observable(SerializableBase<InitializableBaseProperties>).toJSON