furo-api-fetch #
@furo/data v2.18.0
import '@furo/data/src/furo-api-fetch.js';
exports FuroApiFetch js
exports <furo-api-fetch>
custom-element-definition
superclass HTMLElement
summary fetch data from network
Use furo-api-fetch
to fetch data from the network.
|
|
Attributes and Properties #
lastRequest #
default: {}
LastRequest’s response.
Note that lastResponse is set when ongoing request finishes, so if loading is true,
then lastResponse will correspond to the result of the previous request.
isLoading #
default: false
True while request is in flight.
Events #
fatal-error #
at-fatal-error
→ Request
Requests are made via the Fetch API if possible.Fallback XMLHttpRequest
request-started #
at-request-started
→ Request
Fired when a request is sent.
request-aborted #
at-request-aborted
→ Request
Fired when a request was canceled.
response-raw #
at-response-raw
→ Object
Fired when a response is received.
response #
at-response
→ Object
Fired when a response is received. Here you will get the parsed response Format depends on request header content-type
supported types: - text/plain - application/json - image/jpeg (Blob) - application/octet-stream (ArrayBuffer) - application/pdf (Blob)
parse-error #
at-parse-error
→ CustomEvent
response-error-raw #
at-response-error-raw
→ Object
Fired when a error has occoured.
response-error #
at-response-error
→ Object
Fired when an error has occoured. This is a general error event. The specific error events are fired additionally.
**** #
at-
→ CustomEvent
response-error-[status-code] #
at-response-error-[status-code]
→ Object
Fired when an error has occoured. This is a specific error event.
response-error-4xx #
at-response-error-4xx
→ Object
Fired when an error has occoured. This is a group error event. E.g. response-error-5xx, response-error-4xx
response-error-5xx #
at-response-error-5xx
→ Object
Fired when an error has occoured. This is a group error event. E.g. response-error-5xx, response-error-4xx
Methods #
invokeRequest #
invokeRequest(request Request
) ⟹ void
Request
→
fn-invoke-request
Sends a HTTP request to the server
- request (The Request interface of the Fetch API represents a resource request.)
https://developer.mozilla.org/en-US/docs/Web/API/Request
abortRequest #
abortRequest(controller AbortController
) ⟹ void
AbortController
→
fn-abort-request
Aborts a pending request You have to submit an AbortController
- controller (The AbortController interface represents a controller object that allows you to abort one or more DOM requests as and when desired.)
https://developer.mozilla.org/en-US/docs/Web/API/AbortController