Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: SpawnJSObject
Source: JSObjects/BackgroundFetchRecord.cs
MDN Reference: BackgroundFetchRecord on MDN
The BackgroundFetchRecord interface of the Background Fetch API represents an individual request and response. A BackgroundFetchRecord is created by the BackgroundFetchRegistration.matchAll() method, therefore there is no constructor for this interface. There will be one BackgroundFetchRecord for each resource requested by fetch(). https://developer.mozilla.org/en-US/docs/Web/API/BackgroundFetchRecord
| Property | Type | Access | Description |
|---|---|---|---|
Request |
Request |
get | Returns a Request. |
ResponseReady |
Task<Response> |
get | Returns a promise that resolves with a Response. |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<BackgroundFetchRecord>(...)or constructornew BackgroundFetchRecord(...)
bgFetch.match("/ep-5.mp3").then(async (record) => {
if (!record) {
console.log("No record found");
return;
}
console.log(`Here's the request`, record.request);
const response = await record.responseReady;
console.log(`And here's the response`, response);
});