Edit this page

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

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.

Aborting requests

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' })

Low-level API

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

If possible, prefer up.fragment.abort(), which matches requests by screen region. Only when requests are aborted by screen region, components can react to being aborted.


Matching requests

[element]
optional

The element (or selector) for which requests should be aborted.

May be omitted with { layer } option.

[options.layer]
optional

The layer for which requests should be aborted.

May be omitted with element argument.

stringup.Layer
[options.origin]
optional

The element causing requests to be aborted.

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

[options.except]
optional

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

Debugging

[options.reason]
optional

The reason for aborting requests.

The promise by an aborted up.request() will reject with this reason to help debugging an unexpected aborting.

If omitted, a default message will describe the abort conditions.

string