Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: Event
Source: JSObjects/PageTransitionEvent.cs
MDN Reference: PageTransitionEvent on MDN
The PageTransitionEvent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded. https://developer.mozilla.org/en-US/docs/Web/API/PageTransitionEvent
| Property | Type | Access | Description |
|---|---|---|---|
Persisted |
bool |
get | Indicates if the document is loading from a cache. |
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<PageTransitionEvent>(...)or constructornew PageTransitionEvent(...)
window.addEventListener("pageshow", (event) => {
if (event.persisted) {
alert("The page was cached by the browser");
} else {
alert("The page was NOT cached by the browser");
}
});