Types
import type { EventedMixin } from "@arcgis/core/core/Evented.js";- Subclasses
- Map, Map, Collection, Collection, Credential, Credential, IdentityManagerBase, Layer, ElevationSampler, ElevationSampler, KMLSublayer, LocalMediaElementSource, LocalMediaElementSource, StreamConnection, StreamConnection, Circuit, CircuitSection, Subcircuit, View, SelectionManager, SelectionManager, VideoView, AnalysisView, AnalysisView, LayerView, LayerView, SunLighting, VirtualLighting, DrawAction, DrawAction, Tooltip, Tooltip, UI, UI, Slide, Widget, Widget, BasemapLayerListViewModel, BasemapLayerListViewModel, BatchAttributeFormViewModel, BatchAttributeFormViewModel, BookmarksViewModel, BookmarksViewModel, CatalogLayerListViewModel, CatalogLayerListViewModel, CoordinateConversionViewModel, CoordinateConversionViewModel, DaylightViewModel, DaylightViewModel, DirectionalPadViewModel, DirectionalPadViewModel, DirectionsViewModel, DirectionsViewModel, Workflow, Workflow, EditorViewModel, EditorViewModel, ElevationProfileLine, ElevationProfileLine, FeatureFormViewModel, FeatureFormViewModel, FeatureTemplatesViewModel, FeatureTemplatesViewModel, FeaturesViewModel, FeaturesViewModel, HomeViewModel, HomeViewModel, LayerListViewModel, LayerListViewModel, LinkChartLayoutSwitcherViewModel, LinkChartLayoutSwitcherViewModel, GeolocationPositioning, GeolocationPositioning, OrientedImageryViewerViewModel, PrintViewModel, PrintViewModel, SearchViewModel, SearchViewModel, SketchViewModel, SketchViewModel, TableListViewModel, TableListViewModel, TimeSliderViewModel, TimeSliderViewModel, UtilityNetworkTraceViewModel, UtilityNetworkTraceViewModel, GridControlsViewModel, GridControlsViewModel
- Since
- ArcGIS Maps SDK for JavaScript 4.0
Methods
| Method | Signature | Class |
|---|---|---|
| emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean | | |
| hasEventListener<Type extends EventNames<this>>(type: Type): boolean | | |
| on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle | |
emit
Method
- Signature
-
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
- Type parameters
- <Type extends EventNames<this>>
- Since
- ArcGIS Maps SDK for JavaScript 4.5
Emits an event on the instance. This method should only be used when creating subclasses of this class.
hasEventListener
Method
- Signature
-
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
- Type parameters
- <Type extends EventNames<this>>
Indicates whether there is an event listener on the instance that matches the provided event name.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | The name of the event. | |
- Returns
- boolean
Returns true if the class supports the input event.
on
Method
- Signature
-
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
- Type parameters
- <Type extends EventNames<this>>
Registers an event handler on the instance. Call this method to hook an event with a listener.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| type | Type | An event or an array of events to listen for. | |
| listener | EventedCallback<this["@eventTypes"][Type]> | The function to call when the event fires. | |
- Returns
- ResourceHandle
Returns an event handler with a
remove()method that should be called to stop listening for the event(s).Property Type Description remove Function When called, removes the listener from the event.
- Example
- view.on("click", function(event){// event is the event handle returned after the event fires.console.log(event.mapPoint);});
Type definitions
Evented
Type definition
Evented is a base class for objects that can emit events. It is used by many classes in the ArcGIS API for JavaScript to provide event handling capabilities.
- Supertypes
- EventedMixin
EventedCallback
Type definition
- Type parameters
- <T = any>
EventNames
Type definition
- Type parameters
- <Evented extends { "@eventTypes": unknown; }>
- Type
- keyof Evented["@eventTypes"] & string
EventTypes
Type definition
- Type parameters
- <T>
- Type
- T extends EventedMixin ? T["@eventTypes"] : never