Edit this page

up.fragment up.fragment.onAborted(element, callback)
JavaScript function

This feature is experimental. It may be changed or removed in a future version.

Runs a callback when the given element or its ancestors were aborted.

This utility function simplifies consumption of the up:fragment:aborted event.


Let's say we want to reload an element after 10 seconds. If requests for that element were aborted before the 10 seconds are over, we no no longer want to reload:

let timeout = setTimeout(() => up.reload(element), 10000)
up.fragment.onAborted(element, () => clearTimeout(timeout))


element Element
callback Function(event)

The callback to run.

It will be called with an up:fragment:aborted argument.

Return value


A function that unsubscribes the callback.