docs: the superseded fallback answers its own session; who uses beacon()

This commit is contained in:
2026-10-08 01:16:30 +02:00
parent 5095047c81
commit a504550196
2 changed files with 9 additions and 7 deletions
+6 -5
View File
@@ -285,11 +285,12 @@ export function identityHeaders(): Record<string, string> {
};
}
// Fire-and-forget POST that survives page unload (keepalive) — shared by the resume-position
// beacons (YT + Plex players). A normal fetch is cancelled on unload and React effect cleanup
// doesn't run on a full reload, so without keepalive the last position (esp. right after a seek)
// would be lost. `onSettled`: the request has been answered (or failed) — for a caller whose cached
// view must be read again once the write is on the server.
// Fire-and-forget POST that survives page unload (keepalive) — for every write a closing page must
// still make: the resume checkpoints of the YouTube, Plex and library players, the Plex session stop,
// the diagnostics flush. A normal fetch is cancelled on unload and React effect cleanup doesn't run
// on a full reload, so without keepalive the last position (esp. right after a seek) would be lost.
// `onSettled`: the request has been answered (or failed) — for a caller whose cached view must be
// read again once the write is on the server.
export function beacon(url: string, body: Record<string, unknown>, onSettled?: () => void): void {
try {
void send(url, {