Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: ExtendableEvent
Source: JSObjects/PeriodicSyncEvent.cs
MDN Reference: PeriodicSyncEvent on MDN
The PeriodicSyncEvent interface of the Web Periodic Background Synchronization API provides a way to run tasks in the service worker with network connectivity. https://developer.mozilla.org/en-US/docs/Web/API/PeriodicSyncEvent
| Signature | Description |
|---|---|
PeriodicSyncEvent(SpawnJSObjectReference _ref) |
Deserialization constructor |
| Property | Type | Access | Description |
|---|---|---|---|
Tag |
string |
get | Returns the developer-defined identifier for this PeriodicSyncEvent. Multiple tags can be used by the web app to run different periodic tasks at different frequencies. |
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<PeriodicSyncEvent>(...)or constructornew PeriodicSyncEvent(...)
self.addEventListener("periodicsync", (event) => {
if (event.tag === "get-latest-news") {
event.waitUntil(fetchAndCacheLatestNews());
}
});