Interface Evented
- All Known Subinterfaces:
SupportsDragEvents,SupportsKeyboardEvents,SupportsLayerEvents,SupportsLocationEvents,SupportsMapEvents,SupportsMouseEvents
- All Known Implementing Classes:
Circle,CircleMarker,DivOverlay,DynamicMapLayer,EsriLeafletLayer,FeatureGroup,GridLayer,HeatLayer,ImageOverlay,InteractiveLayer,KmzLayer,Layer,LayerGroup,LeafletMap,Marker,MarkerClusterGroup,MultiPolygon,MultiPolyline,Path,Polygon,Polyline,Popup,Rectangle,TiledMapLayer,TileLayer,Tooltip,VectorBasemapLayer
public interface Evented
A set of methods shared between event-powered classes (like Map and Marker).
Generally, events allow you to execute some function when something happens
with an object (e.g. the user clicks on the map, causing the map to fire
'click' event).
- Since:
- 2020-02-06
- Version:
- 1.0
- Author:
- Gabor Kokeny Email: kokeny19@gmail.com
-
Method Summary
Modifier and TypeMethodDescription<T extends LeafletEvent>
voidaddEventListener(LeafletEventType eventType, LeafletEventListener<T> listener) Adds a listener function (fn) to a particular event type of the object.voidAlias to off()booleanhasEventListeners(LeafletEventType eventType) Alias to listens(…)default booleanlistens(LeafletEventType eventType) Returns true if a particular event type has any listeners attached to it.default voidoff()Removes all listeners to all events on the object.default voidoff(LeafletEventType eventType) Removes a previously added listener function.default <T extends LeafletEvent>
voidon(LeafletEventType eventType, LeafletEventListener<T> listener) Alias to addEventListener(…)voidremoveEventListener(LeafletEventType eventType) Alias to off(…)
-
Method Details
-
addEventListener
<T extends LeafletEvent> void addEventListener(LeafletEventType eventType, LeafletEventListener<T> listener) Adds a listener function (fn) to a particular event type of the object.- Type Parameters:
T- the generic type of the leaflet object- Parameters:
eventType- type of the event to be listeninglistener- the event listener
-
on
default <T extends LeafletEvent> void on(LeafletEventType eventType, LeafletEventListener<T> listener) Alias to addEventListener(…)- Type Parameters:
T- the generic type of the leaflet object- Parameters:
eventType- type of the event to be listeninglistener- the event listener
-
removeEventListener
Alias to off(…)- Parameters:
eventType- the event type
-
off
Removes a previously added listener function.- Parameters:
eventType- the event type
-
clearAllEventListeners
void clearAllEventListeners()Alias to off() -
off
default void off()Removes all listeners to all events on the object. This includes implicitly attached events. -
hasEventListeners
Alias to listens(…)- Parameters:
eventType- the event type- Returns:
- true if a particular event type has any listeners attached to it
-
listens
Returns true if a particular event type has any listeners attached to it.- Parameters:
eventType- the event type- Returns:
- true if a particular event type has any listeners attached to it
-