Skip to content

Commit

Permalink
Remove broken check (#1157)
Browse files Browse the repository at this point in the history
* Remove broken check

The check, for some reason, was not removed in this PR: #1037

* Force `type: 'node'` for Node.js v18 in some tests

* Fix Node.js v18 fallback to `node` method

* Refactor if statement
  • Loading branch information
mrlika authored Apr 25, 2023
1 parent faff061 commit 7487f87
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/methods/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export function onMessage(channelState, fn) {
}

export function canBeUsed() {
if (typeof window === 'undefined') {
return false;
}
if (typeof BroadcastChannel === 'function') {
if (
(typeof window !== 'undefined' || typeof self !== 'undefined') &&
typeof BroadcastChannel === 'function'
) {
if (BroadcastChannel._pubkey) {
throw new Error(
'BroadcastChannel: Do not overwrite window.BroadcastChannel with this module, this is not a polyfill'
Expand Down

0 comments on commit 7487f87

Please sign in to comment.