Sha256: f039f613d257d0ca8f35965a379a30ec504df5adf5ceb8c200be4fde292333c7
Contents?: true
Size: 709 Bytes
Versions: 26
Compression:
Stored size: 709 Bytes
Contents
import { FindWorker } from '../../glossary' /** * Attempts to resolve a Service Worker instance from a given registration, * regardless of its state (active, installing, waiting). */ export function getWorkerByRegistration( registration: ServiceWorkerRegistration, absoluteWorkerUrl: string, findWorker: FindWorker, ): ServiceWorker | null { const allStates = [ registration.active, registration.installing, registration.waiting, ] const relevantStates = allStates.filter((state): state is ServiceWorker => { return state != null }) const worker = relevantStates.find((worker) => { return findWorker(worker.scriptURL, absoluteWorkerUrl) }) return worker || null }
Version data entries
26 entries across 26 versions & 1 rubygems