Events in Kontrast

Many objects in Kontrast emit events. You can subscribe to events using the addEventListener functions on the object, providing the name of the event and a custom function that should be called whenever the event is emitted (or fired).

Note that the name of the function addEventListener is deliberately chosen to be the same as the function used for DOM manipulations (see the corresponding MDN page on EventTarget.addEventListener()). However, in contrast to the DOM version of the function, an exception is thrown if the event name does not exist.

Please refer to the tutorial for an introductory example on how to use events.

The names and descriptions of available events can be found in the documentation for each object and in the reference index.