Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-broadcast-ts

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-broadcast-ts - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

11

dist/index.js

@@ -148,3 +148,8 @@ 'use strict';

var _options$name;
if (typeof window === 'undefined') {
/**
* The broadcast channel is not supported in SSR
*/
if (typeof window === 'undefined' &&
// @ts-expect-error WorkerGlobalScope is not defined in the types
!(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)) {
console.warn('BroadcastChannel is not supported in this environment. The store will not be shared.');

@@ -399,3 +404,5 @@ return f(set, get, store);

*/
window.addEventListener('beforeunload', onClose);
if (typeof window !== 'undefined') {
window.addEventListener('beforeunload', onClose);
}

@@ -402,0 +409,0 @@ /**

2

package.json
{
"name": "use-broadcast-ts",
"version": "1.6.0",
"version": "1.7.0",
"description": "Use the Broadcast Channel API in React easily with hooks or Zustand, and Typescript!",

@@ -5,0 +5,0 @@ "type": "module",

@@ -59,3 +59,10 @@ import { StateCreator, StoreMutatorIdentifier } from 'zustand';

const sharedImpl: SharedImpl = (f, options) => (set, get, store) => {
if (typeof window === 'undefined') {
/**
* The broadcast channel is not supported in SSR
*/
if (
typeof window === 'undefined' &&
// @ts-expect-error WorkerGlobalScope is not defined in the types
!(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
) {
console.warn('BroadcastChannel is not supported in this environment. The store will not be shared.');

@@ -316,3 +323,5 @@ return f(set, get, store);

*/
window.addEventListener('beforeunload', onClose);
if (typeof window !== 'undefined') {
window.addEventListener('beforeunload', onClose);
}

@@ -319,0 +328,0 @@ /**

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc