Event system

event class

google.maps.event class

Namespace for all public event functions

Access by calling const {event} = await google.maps.importLibrary("core").
See Libraries in the Maps JavaScript API.

addListener
addListener(instance, eventName, handler)
Parameters: 
Return Value:  MapsEventListener
Adds the given listener function to the given event name for the given object instance. Returns an identifier for this listener that can be used with removeListener().
addListenerOnce
addListenerOnce(instance, eventName, handler)
Parameters: 
Return Value:  MapsEventListener
Like addListener, but the handler removes itself after handling the first event.
clearInstanceListeners
clearInstanceListeners(instance)
Parameters: 
Return Value:  void
Removes all listeners for all events for the given instance.
clearListeners
clearListeners(instance, eventName)
Parameters: 
  • instanceObject
  • eventNamestring
Return Value:  void
Removes all listeners for the given event for the given instance.
hasListeners
hasListeners(instance, eventName)
Parameters: 
  • instanceObject
  • eventNamestring
Return Value:  boolean
Returns if there are listeners for the given event on the given instance. Can be used to save the computation of expensive event details.
removeListener
removeListener(listener)
Parameters: 
Return Value:  void
Removes the given listener, which should have been returned by addListener above. Equivalent to calling listener.remove().
trigger
trigger(instance, eventName, eventArgs)
Parameters: 
  • instanceObject
  • eventNamestring
  • eventArgs...?
Return Value:  void
Triggers the given event. All arguments after eventName are passed as arguments to the listeners.
addDomListener
addDomListener(instance, eventName, handler[, capture])
Parameters: 
  • instanceObject
  • eventNamestring
  • handlerFunction
  • captureboolean optional
Return Value:  MapsEventListener
Cross browser event handler registration. This listener is removed by calling removeListener(handle) for the handle that is returned by this function.
addDomListenerOnce
addDomListenerOnce(instance, eventName, handler[, capture])
Parameters: 
  • instance