Skip to content

Commit

Permalink
chore(setupWorker): move "useFallbackMode" to "supports.serviceWorker…
Browse files Browse the repository at this point in the history
…Api"
  • Loading branch information
kettanaito committed Oct 15, 2023
1 parent d54ad52 commit 4a788d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/browser/setupWorker/glossary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ export interface SetupWorkerInternalContext {
ServiceWorkerMessage<EventType, ServiceWorkerIncomingEventsMap[EventType]>
>
}
useFallbackMode: boolean
supports: {
serviceWorkerApi: boolean
readableStreamTransfer: boolean
}
fallbackInterceptor?: Interceptor<HttpRequestEventMap>
Expand Down
8 changes: 4 additions & 4 deletions src/browser/setupWorker/setupWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ export class SetupWorkerApi
})
},
},
useFallbackMode:
!('serviceWorker' in navigator) || location.protocol === 'file:',
supports: {
serviceWorkerApi:
!('serviceWorker' in navigator) || location.protocol === 'file:',
readableStreamTransfer: supportsReadableStreamTransfer(),
},
}
Expand All @@ -160,11 +160,11 @@ export class SetupWorkerApi
},
})

this.startHandler = context.useFallbackMode
this.startHandler = context.supports.serviceWorkerApi
? createFallbackStart(context)
: createStartHandler(context)

this.stopHandler = context.useFallbackMode
this.stopHandler = context.supports.serviceWorkerApi
? createFallbackStop(context)
: createStop(context)

Expand Down

0 comments on commit 4a788d2

Please sign in to comment.