up.layer up:layer:dismiss
DOM event

This event is emitted before a layer is dismissed.

The event is emitted on the element of the layer that is about to close.


Event properties

event.layer
required

The layer that is about to close.

Type: up.Layer
[event.value]
optional

The overlay's dismissal value.

Listeners can replace or mutate this value.

Type: any
[event.origin]
optional

The element that is causing the layer to close.

Will be undefined if the overlay is not closing due to a user interacting with an element.

Type: Element
[event.response]
optional

The server response that is causing this overlay to close.

Will be undefined if the overlay is not closing in reaction to a server response.

See Using the discarded response.

Type: up.Response
event.preventDefault()
required

Event listeners can call this method to prevent the overlay from closing.

This has no effect when the overlay is closed because a background layer is being updated. In that case event.value is ':peel'.

To prevent closing for a single overlay, pass an { onDismiss } option or set an [up-on-dismiss] attribute when opening it.