Skip to content

Commit

Permalink
Add conditional checks for window object (#839)
Browse files Browse the repository at this point in the history
  • Loading branch information
chacha912 authored Jun 4, 2024
1 parent 7b5ed93 commit e0fd6c9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/devtools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ const unsubsByDocKey = new Map<string, Array<() => void>>();
* IndexedDB will be used.
*/
const transactionEventsByDocKey = new Map<string, Array<TransactionEvent>>();
(window as any).transactionEventsByDocKey = transactionEventsByDocKey;
declare global {
interface Window {
transactionEventsByDocKey: Map<string, Array<TransactionEvent>>;
}
}
if (typeof window !== 'undefined') {
window.transactionEventsByDocKey = transactionEventsByDocKey;
}

/**
* `sendToPanel` sends a message to the devtools panel.
Expand Down

0 comments on commit e0fd6c9

Please sign in to comment.