react-broadcast-sync 1.5.1 → 1.8.0
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/README.md +59 -11
- package/dist/BroadcastProvider.d.ts +2 -7
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/types/types.d.ts +17 -0
- package/dist/utils/debug.d.ts +7 -1
- package/package.json +6 -1
- package/.eslintignore +0 -5
- package/.github/workflows/ci.yml +0 -61
- package/.github/workflows/release.yml +0 -39
- package/.husky/pre-commit +0 -5
- package/.nvmrc +0 -1
- package/.prettierignore +0 -4
- package/.prettierrc +0 -9
- package/.releaserc.json +0 -22
- package/CHANGELOG.md +0 -90
- package/assets/react-broadcast-sync-logo.png +0 -0
- package/commitlint.config.js +0 -3
- package/demo/react-broadcast-sync-demo/README.md +0 -130
- package/demo/react-broadcast-sync-demo/index.html +0 -14
- package/demo/react-broadcast-sync-demo/package-lock.json +0 -6379
- package/demo/react-broadcast-sync-demo/package.json +0 -42
- package/demo/react-broadcast-sync-demo/public/assets/react-broadcast-sync-demo-video.gif +0 -0
- package/demo/react-broadcast-sync-demo/public/assets/react-broadcast-sync-logo.png +0 -0
- package/demo/react-broadcast-sync-demo/src/App.tsx +0 -277
- package/demo/react-broadcast-sync-demo/src/components/Counter.tsx +0 -63
- package/demo/react-broadcast-sync-demo/src/components/TextSync.tsx +0 -61
- package/demo/react-broadcast-sync-demo/src/components/TodoList.tsx +0 -186
- package/demo/react-broadcast-sync-demo/src/hooks/useCounterBroadcast.ts +0 -96
- package/demo/react-broadcast-sync-demo/src/hooks/useTextBroadcast.ts +0 -37
- package/demo/react-broadcast-sync-demo/src/hooks/useTodoBroadcast.ts +0 -249
- package/demo/react-broadcast-sync-demo/src/main.tsx +0 -11
- package/demo/react-broadcast-sync-demo/src/theme.ts +0 -62
- package/demo/react-broadcast-sync-demo/tsconfig.json +0 -26
- package/demo/react-broadcast-sync-demo/tsconfig.node.json +0 -10
- package/demo/react-broadcast-sync-demo/vite.config.ts +0 -12
- package/eslint.config.js +0 -38
- package/jest.config.cjs +0 -9
- package/jest.setup.ts +0 -1
- package/rollup.config.mjs +0 -98
- package/src/BroadcastProvider.tsx +0 -80
- package/src/hooks/useBroadcastChannel.ts +0 -464
- package/src/index.ts +0 -9
- package/src/tests/BroadcastProvider.test.tsx +0 -163
- package/src/tests/debug.test.ts +0 -239
- package/src/tests/messageUtils.test.ts +0 -252
- package/src/tests/useBroadcastChannel.same-tab.test.tsx +0 -992
- package/src/tests/useBroadcastChannel.test.tsx +0 -1243
- package/src/types/types.ts +0 -124
- package/src/utils/debug.ts +0 -54
- package/src/utils/messageUtils.ts +0 -122
- package/tsconfig.json +0 -36
package/CHANGELOG.md
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
## [1.5.1](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.5.0...v1.5.1) (2025-07-03)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* added readme for batching ([568a52c](https://github.com/IdanShalem/react-broadcast-sync/commit/568a52c4d23443a1e4c2a0c2ab10a6c618c68529))
|
|
7
|
-
|
|
8
|
-
# [1.5.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.4.0...v1.5.0) (2025-07-03)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Features
|
|
12
|
-
|
|
13
|
-
* batch messages with delay ([6dde9fa](https://github.com/IdanShalem/react-broadcast-sync/commit/6dde9fa441e2f5fc4745c00fdbabdf48f697d58b))
|
|
14
|
-
|
|
15
|
-
# [1.4.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.3.0...v1.4.0) (2025-06-29)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### Features
|
|
19
|
-
|
|
20
|
-
* ping for other sources ([794631a](https://github.com/IdanShalem/react-broadcast-sync/commit/794631ae118da61dd888b18ca3d960ae4869498d))
|
|
21
|
-
|
|
22
|
-
# [1.3.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.2.1...v1.3.0) (2025-06-16)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Features
|
|
26
|
-
|
|
27
|
-
* added getLatestMessage and closeChannel methods ([2ca0c32](https://github.com/IdanShalem/react-broadcast-sync/commit/2ca0c320c6558fd4205a8965d364d49c07609e97))
|
|
28
|
-
|
|
29
|
-
## [1.2.1](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.2.0...v1.2.1) (2025-06-11)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Bug Fixes
|
|
33
|
-
|
|
34
|
-
* added unit testing for same tab scenarios ([5e3df1d](https://github.com/IdanShalem/react-broadcast-sync/commit/5e3df1deab456565a09f0dfda84b21b526f157ba))
|
|
35
|
-
|
|
36
|
-
# [1.2.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.4...v1.2.0) (2025-06-08)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Features
|
|
40
|
-
|
|
41
|
-
* clearReceivedMessages and clearSentMessages improved logic ([92916d8](https://github.com/IdanShalem/react-broadcast-sync/commit/92916d80f3a79cadb2f34c11f3f9759f6d74f8b2))
|
|
42
|
-
|
|
43
|
-
## [1.1.4](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.3...v1.1.4) (2025-06-03)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### Bug Fixes
|
|
47
|
-
|
|
48
|
-
* removed icon ([3488a8d](https://github.com/IdanShalem/react-broadcast-sync/commit/3488a8d9526e5561f5ffdd14dfcce5ebb20c6838))
|
|
49
|
-
|
|
50
|
-
## [1.1.3](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.2...v1.1.3) (2025-06-03)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### Bug Fixes
|
|
54
|
-
|
|
55
|
-
* updated readme ([621d73b](https://github.com/IdanShalem/react-broadcast-sync/commit/621d73bc93c0b5538faf158e97a06696a8ad1f0e))
|
|
56
|
-
|
|
57
|
-
## [1.1.2](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.1...v1.1.2) (2025-06-03)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Bug Fixes
|
|
61
|
-
|
|
62
|
-
* added demo gif presentation ([23781aa](https://github.com/IdanShalem/react-broadcast-sync/commit/23781aa4b61ab30ae9c37fd2b017446bc9cf039e))
|
|
63
|
-
|
|
64
|
-
## [1.1.1](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.1.0...v1.1.1) (2025-06-03)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Bug Fixes
|
|
68
|
-
|
|
69
|
-
* fixed sync problem in counter demo app ([481bda7](https://github.com/IdanShalem/react-broadcast-sync/commit/481bda79f55b3b902861877d4446bc4adaa76941))
|
|
70
|
-
|
|
71
|
-
# [1.1.0](https://github.com/IdanShalem/react-broadcast-sync/compare/v1.0.0...v1.1.0) (2025-06-03)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
### Features
|
|
75
|
-
|
|
76
|
-
* added demo app deployment ([755bee2](https://github.com/IdanShalem/react-broadcast-sync/commit/755bee2c11bafcaa0653917bae8e288500f6dec6))
|
|
77
|
-
|
|
78
|
-
# 1.0.0 (2025-05-30)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
### Bug Fixes
|
|
82
|
-
|
|
83
|
-
* update favicon path and remove duplicate link ([c6bb7d8](https://github.com/IdanShalem/react-broadcast-sync/commit/c6bb7d85f09e36eb2e3c5da71485c247bd29ba37))
|
|
84
|
-
* updated readme and fixed ci ([56d76d0](https://github.com/IdanShalem/react-broadcast-sync/commit/56d76d0ee342cce9e29968e9fb8b0fe9ee8b89fd))
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### Features
|
|
88
|
-
|
|
89
|
-
* demo app ([0717637](https://github.com/IdanShalem/react-broadcast-sync/commit/07176372544f2c29ad184d8107fc176881397e5b))
|
|
90
|
-
* fix ci flow ([3dfd575](https://github.com/IdanShalem/react-broadcast-sync/commit/3dfd575db288b2f1923859ccc2acc3d52de4c70c))
|
|
Binary file
|
package/commitlint.config.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
# React Broadcast Sync Demo
|
|
2
|
-
|
|
3
|
-
A showcase application demonstrating the capabilities of `react-broadcast-sync` - a library for synchronizing state across browser tabs.
|
|
4
|
-
|
|
5
|
-
## 🚀 Live Demo
|
|
6
|
-
|
|
7
|
-
Check out the [live demo](https://react-broadcast-sync.vercel.app) to see the synchronization in action!
|
|
8
|
-
|
|
9
|
-
## 🎯 Features
|
|
10
|
-
|
|
11
|
-
The demo showcases three main features:
|
|
12
|
-
|
|
13
|
-
1. **Counter Synchronization**
|
|
14
|
-
|
|
15
|
-
- Real-time counter updates across tabs
|
|
16
|
-
- Visual feedback for sync status
|
|
17
|
-
- Smooth animations
|
|
18
|
-
|
|
19
|
-
2. **Text Synchronization**
|
|
20
|
-
|
|
21
|
-
- Real-time text input sync
|
|
22
|
-
- Multi-line support
|
|
23
|
-
- Instant updates
|
|
24
|
-
|
|
25
|
-
3. **Todo List**
|
|
26
|
-
- Synchronized todo items
|
|
27
|
-
- Real-time hover effects
|
|
28
|
-
- Scroll position sync
|
|
29
|
-
- Completion status sync
|
|
30
|
-
- Delete functionality
|
|
31
|
-
|
|
32
|
-
## 🛠️ Technologies Used
|
|
33
|
-
|
|
34
|
-
- React 19
|
|
35
|
-
- TypeScript
|
|
36
|
-
- Material-UI
|
|
37
|
-
- Framer Motion
|
|
38
|
-
- Vite
|
|
39
|
-
|
|
40
|
-
## 🚀 Getting Started
|
|
41
|
-
|
|
42
|
-
1. Clone the repository:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
git clone https://github.com/IdanShalem/react-broadcast-sync.git
|
|
46
|
-
cd react-broadcast-sync/demo/react-broadcast-sync-demo
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
2. Install dependencies:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
npm install
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
3. Start the development server:
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
npm run dev
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
4. Open multiple browser tabs to see the synchronization in action!
|
|
62
|
-
|
|
63
|
-
## 📁 Project Structure
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
src/
|
|
67
|
-
├── components/
|
|
68
|
-
│ ├── Counter.tsx
|
|
69
|
-
│ ├── TextSync.tsx
|
|
70
|
-
│ └── TodoList.tsx
|
|
71
|
-
├── hooks/
|
|
72
|
-
│ ├── useCounterBroadcast.ts
|
|
73
|
-
│ ├── useTextBroadcast.ts
|
|
74
|
-
│ └── useTodoBroadcast.ts
|
|
75
|
-
├── App.tsx
|
|
76
|
-
├── main.tsx
|
|
77
|
-
└── theme.ts
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## 💡 Implementation Details
|
|
81
|
-
|
|
82
|
-
### Counter Synchronization
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
const { messages, postMessage } = useBroadcastChannel('counter', {
|
|
86
|
-
keepLatestMessage: true,
|
|
87
|
-
namespace: 'demo-app',
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
### Text Synchronization
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
const { messages, postMessage } = useBroadcastChannel('text', {
|
|
95
|
-
keepLatestMessage: true,
|
|
96
|
-
namespace: 'demo-app',
|
|
97
|
-
});
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Todo List Synchronization
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
const { messages, postMessage } = useBroadcastChannel('todos', {
|
|
104
|
-
keepLatestMessage: true,
|
|
105
|
-
namespace: 'demo-app',
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## 🎨 UI/UX Features
|
|
110
|
-
|
|
111
|
-
- Responsive design
|
|
112
|
-
- Smooth animations
|
|
113
|
-
- Visual feedback for sync status
|
|
114
|
-
- Modern Material-UI components
|
|
115
|
-
- Dark mode support
|
|
116
|
-
|
|
117
|
-
## 🤝 Contributing
|
|
118
|
-
|
|
119
|
-
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
120
|
-
|
|
121
|
-
## 📝 License
|
|
122
|
-
|
|
123
|
-
This project is licensed under the MIT License - see the [LICENSE](../../LICENSE) file for details.
|
|
124
|
-
|
|
125
|
-
## 👥 Author
|
|
126
|
-
|
|
127
|
-
Idan Shalem
|
|
128
|
-
|
|
129
|
-
- GitHub: [@IdanShalem](https://github.com/IdanShalem)
|
|
130
|
-
- LinkedIn: [Idan Shalem](https://www.linkedin.com/in/idan-shalem-3a1781169/)
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/png" href="/assets/react-broadcast-sync-logo.png" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>React Broadcast Sync Demo</title>
|
|
8
|
-
</head>
|
|
9
|
-
|
|
10
|
-
<body>
|
|
11
|
-
<div id="root"></div>
|
|
12
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
13
|
-
</body>
|
|
14
|
-
</html>
|