Edit this page

API Network requests
module up.network

This package implements an optimized HTTP client that is used for all requests made through Unpoly.

The HTTP client offers many quality-of-life improvements, for example:

Unpoly's HTTP client is used automatically when rendering, e.g. when following a link or submitting a form. To use the client from your own JavaScripts, use up.request().

Topics

Essential features

All features

JS
up.ajax([url], [options]) deprecated

Makes an AJAX request to the given URL and caches the response.

JS
up.cache.alias(oldRequest, newRequest) experimental

Makes the cache assume that newRequest has the same response as the already cached oldRequest.

JS
up.cache.clear() deprecated

Expires cache entries.

JS
up.cache.evict([pattern]) stable

Evicts responses in the cache.

JS
up.cache.expire([pattern]) stable

Expires entries in the cache.

JS
up.cache.get(requestOptions) experimental

Returns a cached request matching the given request options.

JS
up.network.abort([condition], [options]) stable

Aborts pending requests matching a condition.

JS
up.network.config stable

Sets default options for this package.

JS
up.network.isBusy() stable

Returns whether Unpoly is currently loading a request.

JS
up.network.isIdle() deprecated

Returns whether Unpoly is not currently loading a request.

JS
up:network:late stable

This event is emitted when AJAX requests are taking long to finish loading.

JS
up.network.loadPage(options) experimental

Makes a full-page request, replacing the entire browser environment with a new page from the server response.

JS
up:network:recover stable

This event is emitted when AJAX requests have taken long to finish, but have finished now.

JS
up.proxy.clear() deprecated

Expires all cache entries.

JS
up.proxy.preload(link) deprecated

Preloads the given link.

JS
up.request([url], [options]) stable

Makes an AJAX request to the given URL.

JS
up:request:aborted experimental

This event is emitted when an AJAX request was aborted.

JS
up:request:load stable

This event is emitted before an AJAX request is sent over the network.

JS
up:request:loaded stable

This event is emitted when the response to an AJAX request has been received.

JS
up:request:offline stable

This event is emitted when an AJAX request encounters fatal error like a timeout or loss of network connectivity.