react-broadcast-sync 1.1.1 โ†’ 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.1.3](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.2...v1.1.3) (2025-06-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * updated readme ([621d73b](https://github.com/IdanShalem/react-broadcast-sync/commit/621d73bc93c0b5538faf158e97a06696a8ad1f0e))
7
+
8
+ ## [1.1.2](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.1...v1.1.2) (2025-06-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * added demo gif presentation ([23781aa](https://github.com/IdanShalem/react-broadcast-sync/commit/23781aa4b61ab30ae9c37fd2b017446bc9cf039e))
14
+
1
15
  ## [1.1.1](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.0...v1.1.1) (2025-06-03)
2
16
 
3
17
 
package/README.md CHANGED
@@ -34,7 +34,11 @@
34
34
 
35
35
  Easily sync UI state or user events across browser tabs in React apps โ€” notifications, presence, forms, and more. This package provides a clean and type-safe abstraction over the native API, enabling efficient, scoped, and reliable cross-tab messaging.
36
36
 
37
- ## ๐Ÿ“š Table of Contents
37
+ <p align="center">
38
+ <img src="https://raw.githubusercontent.com/IdanShalem/react-broadcast-sync/main/demo/react-broadcast-sync-demo/public/assets/react-broadcast-sync-demo-video.gif" alt="React Broadcast Sync Demo" width="600" />
39
+ </p>
40
+
41
+ ## Table of Contents
38
42
 
39
43
  - [Features](#-features)
40
44
  - [Demo App](#-demo-app)
@@ -50,24 +54,24 @@ Easily sync UI state or user events across browser tabs in React apps โ€” notifi
50
54
  - [Testing](#-testing)
51
55
  - [Browser Support](#-browser-support)
52
56
  - [Coming Soon](#-coming-soon)
53
- - [๐Ÿ“ฆ Versioning & Releases](#-versioning--releases)
57
+ - [Versioning & Releases](#-versioning--releases)
54
58
  - [Contributing](#-contributing)
55
59
  - [License](#-license)
56
60
 
57
61
  ## โœจ Features
58
62
 
59
- - ๐Ÿš€ Simple and intuitive API
60
- - ๐Ÿ”„ Real-time synchronization across tabs
61
- - โœ… TypeScript support
62
- - ๐Ÿ“ฆ Zero dependencies
63
- - ๐Ÿงน Automatic message expiration and cleanup
64
- - ๐Ÿงช Send/receive any serializable message
65
- - ๐Ÿงฉ Namespace and source scoping support
66
- - ๐Ÿ”’ Clear individual or all messages
67
- - โœ… Only accept allowed message types (optional)
68
- - ๐Ÿง  `BroadcastProvider` for context-based usage
63
+ - Simple and intuitive API
64
+ - Real-time synchronization across tabs
65
+ - TypeScript support
66
+ - Zero dependencies
67
+ - Automatic message expiration and cleanup
68
+ - Send/receive any serializable message
69
+ - Namespace and source scoping support
70
+ - Clear individual or all messages
71
+ - Only accept allowed message types (optional)
72
+ - `BroadcastProvider` for context-based usage
69
73
 
70
- ## ๐ŸŽฎ Demo App
74
+ ## Demo App
71
75
 
72
76
  Check out our [live demo](https://react-broadcast-sync-3w3m.vercel.app/) to see the library in action! The demo showcases three main features:
73
77
 
@@ -94,7 +98,7 @@ The demo is built with React 19, TypeScript, Material-UI, and Framer Motion. You
94
98
 
95
99
  ---
96
100
 
97
- ## ๐Ÿ“ฆ Installation
101
+ ## Installation
98
102
 
99
103
  ```bash
100
104
  npm install react-broadcast-sync
@@ -106,9 +110,9 @@ pnpm add react-broadcast-sync
106
110
 
107
111
  ---
108
112
 
109
- ## ๐Ÿš€ Quick Start
113
+ ## Quick Start
110
114
 
111
- ### ๐Ÿ”ง Basic Usage
115
+ ### Basic Usage
112
116
 
113
117
  ```tsx
114
118
  import { useBroadcastChannel } from 'react-broadcast-sync';
@@ -136,7 +140,7 @@ function MyComponent() {
136
140
 
137
141
  ---
138
142
 
139
- ### โš™๏ธ Advanced Usage
143
+ ### Advanced Usage
140
144
 
141
145
  ```tsx
142
146
  const {
@@ -159,7 +163,7 @@ const {
159
163
  });
160
164
  ```
161
165
 
162
- #### ๐Ÿ’ฌ Sending a message with expiration:
166
+ #### Sending a message with expiration:
163
167
 
164
168
  ```tsx
165
169
  postMessage('notification', { text: 'This disappears in 5s' }, { expirationDuration: 5000 });
@@ -167,7 +171,7 @@ postMessage('notification', { text: 'This disappears in 5s' }, { expirationDurat
167
171
 
168
172
  ---
169
173
 
170
- ### ๐Ÿงฉ Using `BroadcastProvider`
174
+ ### Using `BroadcastProvider`
171
175
 
172
176
  You can wrap part of your app with `BroadcastProvider` and use `useBroadcastProvider()` to consume the channel context.
173
177
 
@@ -197,7 +201,7 @@ function NotificationBar() {
197
201
 
198
202
  ---
199
203
 
200
- ## ๐Ÿ“˜ API Reference
204
+ ## API Reference
201
205
 
202
206
  ### `useBroadcastChannel` Hook
203
207
 
@@ -270,7 +274,7 @@ Returns an object with:
270
274
  | `clearSentMessage()` | `function` | Remove a sent message without affecting others |
271
275
  | `error` | `string \| null` | Any runtime error from the channel |
272
276
 
273
- #### ๐Ÿ“จ Send Options:
277
+ #### Send Options:
274
278
 
275
279
  ```ts
276
280
  interface SendMessageOptions {
@@ -279,7 +283,7 @@ interface SendMessageOptions {
279
283
  }
280
284
  ```
281
285
 
282
- #### ๐Ÿ“ฉ Message Format:
286
+ #### Message Format:
283
287
 
284
288
  ```ts
285
289
  interface BroadcastMessage {
@@ -294,7 +298,7 @@ interface BroadcastMessage {
294
298
 
295
299
  ---
296
300
 
297
- ## โœ… Best Practices
301
+ ## Best Practices
298
302
 
299
303
  - **Use `namespace`** to isolate functionality between different app modules.
300
304
  - **Register allowed message types** using `registeredTypes` to avoid processing unknown or irrelevant messages.
@@ -303,7 +307,7 @@ interface BroadcastMessage {
303
307
  - **Set appropriate `deduplicationTTL`** based on your message frequency and importance.
304
308
  - **Use `cleanupDebounceMs`** when dealing with rapid message updates to prevent performance issues.
305
309
 
306
- ## ๐ŸŽฏ Common Use Cases
310
+ ## Common Use Cases
307
311
 
308
312
  ### Real-time Notifications
309
313
 
@@ -360,7 +364,7 @@ function TabStatus() {
360
364
  }
361
365
  ```
362
366
 
363
- ## ๐Ÿ”ง Performance Considerations
367
+ ## Performance Considerations
364
368
 
365
369
  ### Message Size
366
370
 
@@ -423,7 +427,7 @@ function ChatComponent() {
423
427
  - Use message expiration for temporary data
424
428
  - Consider using `keepLatestMessage: true` for status updates to prevent memory buildup
425
429
 
426
- ## ๐Ÿšจ Troubleshooting
430
+ ## Troubleshooting
427
431
 
428
432
  ### Common Issues
429
433
 
@@ -460,7 +464,7 @@ This will log:
460
464
  - Cleanup operations
461
465
  - Error states
462
466
 
463
- ## ๐Ÿงช Testing
467
+ ## Testing
464
468
 
465
469
  ### Unit Testing
466
470
 
@@ -499,7 +503,7 @@ test('should render messages from provider', () => {
499
503
 
500
504
  ---
501
505
 
502
- ## ๐ŸŒ Browser Support
506
+ ## Browser Support
503
507
 
504
508
  Relies on [BroadcastChannel API](https://developer.mozilla.org/en-US/docs/Web/API/BroadcastChannel):
505
509
 
@@ -511,23 +515,23 @@ Relies on [BroadcastChannel API](https://developer.mozilla.org/en-US/docs/Web/AP
511
515
 
512
516
  ---
513
517
 
514
- ## ๐Ÿ› ๏ธ Coming Soon
518
+ ## Coming Soon
515
519
 
516
520
  We're actively improving `react-broadcast-sync`! Here are some features and enhancements planned for upcoming versions:
517
521
 
518
- - โœ… **Unit and Integration Tests**
522
+ - **Integration Tests**
519
523
  Ensure robust behavior and edge-case coverage.
520
524
 
521
- - ๐Ÿ”„ **Automatic Channel Recovery**
525
+ - **Automatic Channel Recovery**
522
526
  Reconnect automatically if the `BroadcastChannel` gets disconnected or closed by the browser.
523
527
 
524
- - ๐Ÿงผ **`clearMessagesByType()`**
528
+ - **`clearMessagesByType()`**
525
529
  Clear all messages of a specific type with a single call.
526
530
 
527
- - ๐ŸŽฏ **Per-Type Callbacks**
531
+ - **Per-Type Callbacks**
528
532
  Define message handlers for specific types with `onMessage({ type, callback })`.
529
533
 
530
- - ๐Ÿงน **`clearAllSentMessages()` / `clearAllReceivedMessages()`**
534
+ - **`clearAllSentMessages()` / `clearAllReceivedMessages()`**
531
535
  Fine-grained control for clearing messages based on source.
532
536
 
533
537
  We're committed to keeping this package lightweight, flexible, and production-ready.
@@ -535,7 +539,7 @@ Your feedback and contributions are welcome โ€” feel free to [open an issue](htt
535
539
 
536
540
  ---
537
541
 
538
- ## ๐Ÿ“ฆ Versioning & Releases
542
+ ## Versioning & Releases
539
543
 
540
544
  This project uses [Semantic Release](https://semantic-release.gitbook.io/) for fully automated versioning and changelog generation.
541
545
 
@@ -545,7 +549,7 @@ Every push to the `main` branch with a [Conventional Commit](https://www.convent
545
549
  - โœ… Changelog generation and publishing to GitHub Releases
546
550
  - โœ… Publishing to [npm](https://www.npmjs.com/package/react-broadcast-sync)
547
551
 
548
- ### ๐Ÿ”ง Example Commit Messages
552
+ ### Example Commit Messages
549
553
 
550
554
  ```bash
551
555
  feat: add support for per-type callbacks
@@ -554,13 +558,13 @@ chore: update dependencies
554
558
 
555
559
  ---
556
560
 
557
- ## ๐Ÿค Contributing
561
+ ## Contributing
558
562
 
559
563
  PRs and feature suggestions welcome! Open an issue or submit a pull request.
560
564
 
561
565
  ---
562
566
 
563
- ## ๐Ÿชช License
567
+ ## License
564
568
 
565
569
  MIT ยฉ [Idan Shalem](https://github.com/IdanShalem)
566
570
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-broadcast-sync",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "A lightweight React hook and provider for syncing state across browser tabs using BroadcastChannel API.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",