Unpoly ships with an optimized HTTP client for fast and effective communication with your server-side app.
While you can use the browser's native fetch()
function,
Unpoly's up.request()
has a number of convenience features:
X-Up-Target
header. The server may choose to only render the targeted fragment.up:request:loaded
or up:request:late
are emitted throughout the request/response
lifecycle.Makes an AJAX request to the given URL.
This event is emitted when AJAX requests are taking long to finish.
Makes an AJAX request to the given URL and caches the response.
Makes the cache assume that newRequest
has the same response as the
already cached oldRequest
.
Removes all cache entries.
Returns an earlier request matching the given request options.
Manually removes the given request from the cache.
Aborts pending requests.
Sets default options for this package.
Returns whether Unpoly is currently waiting for a request to finish.
Returns whether Unpoly is not currently waiting for a request to finish.
Makes a full-page request, replacing the entire browser environment with a new page from the server response.
Returns whether optional requests should be avoided where possible.
Removes all cache entries.
Makes an AJAX request to the given URL.
This event is emitted when an AJAX request was aborted.
This event is emitted when an AJAX request encounters fatal error like a timeout or loss of network connectivity.
This event is emitted when AJAX requests are taking long to finish.
This event is emitted before an AJAX request is sent over the network.
This event is emitted when the response to an AJAX request has been received.
This event is emitted when AJAX requests have taken long to finish, but have finished now.