(options: ServiceWorkerSourceOptions)
| 82 | > |
| 83 | |
| 84 | constructor(options: ServiceWorkerSourceOptions) { |
| 85 | super() |
| 86 | |
| 87 | invariant( |
| 88 | supportsServiceWorker(), |
| 89 | 'Failed to use Service Worker as the network source: the Service Worker API is not supported in this environment', |
| 90 | ) |
| 91 | |
| 92 | this.#options = options |
| 93 | this.#frames = new Map() |
| 94 | this.workerPromise = new DeferredPromise() |
| 95 | this.#channel = new WorkerChannel({ |
| 96 | getWorker: () => this.workerPromise.then(([worker]) => worker), |
| 97 | }) |
| 98 | } |
| 99 | |
| 100 | public async enable(): Promise<ServiceWorkerRegistration> { |
| 101 | /** |
nothing calls this directly
no test coverage detected