Namespace: SpawnDev.SpawnJS.JSObjects
Source: JSObjects/BackgroundFetchOptions.cs
MDN Reference: BackgroundFetchOptions on MDN
Used to customize the BackgroundFetchManager fetch progress dialog that the browser shows to the user. https://developer.mozilla.org/en-US/docs/Web/API/BackgroundFetchManager/fetch#options
| Property | Type | Access | Description |
|---|---|---|---|
BackgroundFetchOptions |
class |
get/set | Used to customize the BackgroundFetchManager fetch progress dialog that the browser shows to the user. https://developer.mozilla.org/en-US/docs/Web/API/BackgroundFetchManager/fetch#options |
Icons |
IEnumerable<IconInfo>? |
get | |
DownloadTotal |
long? |
get |
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<BackgroundFetchOptions>(...)or constructornew BackgroundFetchOptions(...)
navigator.serviceWorker.ready.then(async (swReg) => {
const bgFetch = await swReg.backgroundFetch.fetch(
"my-fetch",
["/ep-5.mp3", "ep-5-artwork.jpg"],
{
title: "Episode 5: Interesting things.",
icons: [
{
sizes: "300x300",
src: "/ep-5-icon.png",
type: "image/png",
label: "Downloading a show",
},
],
downloadTotal: 60 * 1024 * 1024,
},
);
});