Namespace: SpawnDev.SpawnJS.JSObjects
Source: JSObjects/GetNotificationsOptions.cs
MDN Reference: GetNotificationsOptions on MDN
An object containing options to filter the notifications returned. https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/getNotifications#options
| Property | Type | Access | Description |
|---|---|---|---|
GetNotificationsOptions |
class |
get | An object containing options to filter the notifications returned. https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/getNotifications#options |
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<GetNotificationsOptions>(...)or constructornew GetNotificationsOptions(...)
navigator.serviceWorker.register("sw.js");
const options = { tag: "user_alerts" };
navigator.serviceWorker.ready.then((registration) => {
registration.getNotifications(options).then((notifications) => {
// do something with your notifications
});
});