Skip to content

Commit 8eb4bc8

Browse files
committed
fix destroy method with SharedWorker not supported
1 parent 10f5411 commit 8eb4bc8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/idb-cache/src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,12 @@ export class IDBCache implements IDBCacheInterface {
866866
}
867867

868868
if (this.worker) {
869-
if (this.worker instanceof SharedWorker) {
869+
if (
870+
typeof SharedWorker !== "undefined" &&
871+
this.worker instanceof SharedWorker
872+
) {
870873
this.worker.port.close();
871-
} else {
874+
} else if (this.worker instanceof Worker) {
872875
this.worker.terminate();
873876
}
874877
this.worker = null;

0 commit comments

Comments
 (0)