This feature is experimental. Please share your experiences so we know what to keep or change.
This event is emitted when requests for an element were aborted.
This event is emitted on the element for which requests were aborted. If requests for entire layer were aborted, this event is emitted the layer's outmost element.
To simplify working with this event, the function up.fragment.onAborted()
is also provided.
Note
This event will not be emitted by the low-level
up.network.abort()
function.
This would run code when an element or its descendants were aborted:
up.on(element, 'up:fragment:aborted', function(event) {
// element or its descendants were aborted
})
A more common use case is to run code when an element or one of its ancestors were aborted:
// Listen to all up:fragment:aborted events in case an ancestor
let off = up.on('up:fragment:aborted', function(event) {
if (event.target.contains(element)) {
// element or its ancestors were aborted
}
})
// Because we're registering a global event listener, we should
// clean up when `element` is destroyed.
up.destructor(element, off)
Tip
To simplify observing an element and its ancestors for aborted requests, the function
up.fragment.onAborted()
is provided.
The element for which requests were aborted.
A string describing the reason for aborting this fragment.
Whether the fragment was aborted by a new overlay opening.