Edit this page

API Events
module up.event

This module contains functions to emit and observe DOM events.

While the browser also has built-in functions to work with events, you will find Unpoly's functions to be very concise and feature-rich.

Events emitted by Unpoly

Most Unpoly features emit events that are prefixed with up:.

Unpoly's own events are documented in their respective modules, for example:

Event Module
up:link:follow up.link
up:form:submit up.form
up:layer:open up.layer
up:network:late up.network

Features

Essentials

All features

JS
up.emit([target], eventType, [props]) stable

Emits a custom event with the given name and properties.

HTML
[up-emit] stable

Emits a custom event when this element is clicked.

JS
up.event.build([type], [props]) experimental

Builds an event with the given type and properties.

JS
up.event.halt(event) stable

Prevents the event from being processed further.

JS
up.event.inputDevice experimental

The class of input device used to cause the current event.

JS
up.event.nobodyPrevents(eventType, eventProps) deprecated

Emits an event and returns whether no listener has prevented the default action.

JS
up.event.onEscape(listener) experimental

Registers an event listener to be called when the user presses the Escape key.

JS
up.off([element], events, [selector], listener) stable

Unbinds an event listener previously bound with up.on().

JS
up.on([element], types, [selector], [options], listener) stable

Listens to a DOM event on document or a given element.

JS
up.$on([element], events, [selector], [options], listener) deprecated

Listens to an event on document or a given element. The event handler is called with the event target as a jQuery collection.