use-broadcast-ts
Advanced tools
Comparing version 1.4.5 to 1.5.0
@@ -334,2 +334,3 @@ 'use strict'; | ||
tabs.splice(0, tabs.length, ...e.data.tabs); | ||
options == null ? void 0 : options.onBecomeMain == null ? void 0 : options.onBecomeMain(); | ||
} | ||
@@ -355,2 +356,3 @@ } | ||
isSynced = true; | ||
options == null ? void 0 : options.onBecomeMain == null ? void 0 : options.onBecomeMain(); | ||
} | ||
@@ -357,0 +359,0 @@ }, (_options$mainTimeout = options == null ? void 0 : options.mainTimeout) != null ? _options$mainTimeout : 100); |
@@ -19,2 +19,6 @@ import { StateCreator, StoreMutatorIdentifier } from 'zustand'; | ||
unsync?: boolean; | ||
/** | ||
* Callback when this tab / window becomes the main tab / window | ||
*/ | ||
onBecomeMain?: () => void; | ||
}; | ||
@@ -21,0 +25,0 @@ /** |
{ | ||
"name": "use-broadcast-ts", | ||
"version": "1.4.5", | ||
"version": "1.5.0", | ||
"description": "Use the Broadcast Channel API in React easily with hooks or Zustand, and Typescript!", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -159,2 +159,8 @@ # use-broadcast-ts | ||
##### options.onBecomeMain | ||
Type: `() => void` | ||
A callback that will be called when the tab becomes the main tab. | ||
### useBroadcast (hooks) | ||
@@ -161,0 +167,0 @@ |
@@ -22,2 +22,7 @@ import { StateCreator, StoreMutatorIdentifier } from 'zustand'; | ||
unsync?: boolean; | ||
/** | ||
* Callback when this tab / window becomes the main tab / window | ||
*/ | ||
onBecomeMain?: () => void; | ||
}; | ||
@@ -244,2 +249,4 @@ | ||
tabs.splice(0, tabs.length, ...e.data.tabs); | ||
options?.onBecomeMain?.(); | ||
} | ||
@@ -262,2 +269,4 @@ } | ||
isSynced = true; | ||
options?.onBecomeMain?.(); | ||
} | ||
@@ -264,0 +273,0 @@ }, options?.mainTimeout ?? 100); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42936
1321
244