Makes this service worker lend a session's token to the requests of the pages that registered it
with TwinfinitySession.registerServiceWorker. Call it once, at the top level of the
worker script, so its listeners exist before the first event is dispatched.
Also makes the worker take control of open pages as soon as it activates:
TwinfinitySession.registerServiceWorker waits for that before it resolves.
Tokens are held per page. A service worker serves every tab on its origin, and one tab's token
belongs to that tab's session: it is never added to another tab's requests.
@example
// sw.ts, served alongside the application (scriptUrl resolves against document.baseURI) import{ installServiceWorkerAuthorization }from'@twinfinity/authentication/service-worker'; installServiceWorkerAuthorization(self asunknownas ServiceWorkerGlobalScope).addFetchListener();
Makes this service worker lend a session's token to the requests of the pages that registered it with
TwinfinitySession.registerServiceWorker. Call it once, at the top level of the worker script, so its listeners exist before the first event is dispatched.Also makes the worker take control of open pages as soon as it activates:
TwinfinitySession.registerServiceWorkerwaits for that before it resolves.Tokens are held per page. A service worker serves every tab on its origin, and one tab's token belongs to that tab's session: it is never added to another tab's requests.