Edit this page

up.fragment up.fragment.abort([element], [options])
JavaScript function

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

Aborts requests targeting a fragment or layer.

Always emits the event up:fragment:aborted, regardless of whether there were requests to abort. If a request was aborted, the event up:request:aborted will also be emitted.

There is also a low-level up.network.abort() function, which aborts requests matching arbitrary conditions.

Aborting requests targeting a fragment

To abort pending requests targeting an element or its descendants, pass a reference or CSS selector for that element:

up.fragment.abort(element)
up.fragment.abort('.foo')

You may also pass an { origin } or { layer } option to help look up the selector.

Aborting requests targeting a layer

To abort all requests targeting elements on a given layer, pass a { layer } option:

up.fragment.abort({ layer: 'root' })

Aborting all requests

This would abort requests targeting any elements on any layer:

up.fragment.abort({ layer: 'any' })

Parameters

[element] stringorElementorList<Element> optional

The element for which requests should be aborted.

May be omitted with { layer } option.

[options.layer] stringorup.Layer optional

The layer for which requests should be aborted.

May be omitted with element argument.

[options.origin] Element optional

The element causing requests to be aborted.

This is used to look up an element selector or { layer } name.

[options.reason] string optional

The reason for aborting requests.

The promise by an aborted up.request() will reject with this reason.

If omitted a default message will describe the abort conditions.

[options.except] up.Request optional

A request that should not be aborted, even if it matches the conditions above.