File tree Expand file tree Collapse file tree 4 files changed +24
-3
lines changed
@types/synchronizers/synchronizer-broadcast-channel
synchronizers/synchronizer-broadcast-channel Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 5757 * As well as providing a reference to the MergeableStore to persist, you must
5858 * provide a channel name, used by all the browser tabs, workers, or contexts
5959 * that need to synchronize together.
60+ *
61+ * A final set of optional handlers can be provided to help debug sends,
62+ * receives, and errors respectively.
6063 * @param store The MergeableStore to synchronize.
6164 * @param channelName The name of the channel to use.
65+ * @param onSend An optional handler for the messages that this Synchronizer
66+ * sends. This is suitable for debugging synchronization issues in a development
67+ * environment, since v5.1.
68+ * @param onReceive An optional handler for the messages that this Synchronizer
69+ * receives. This is suitable for debugging synchronization issues in a
70+ * development environment, since v5.1.
6271 * @param onIgnoredError An optional handler for the errors that the
6372 * Synchronizer would otherwise ignore when trying to synchronize data. This is
6473 * suitable for debugging synchronization issues in a development environment.
Original file line number Diff line number Diff line change 11/// synchronizer-broadcast-channel
22
3+ import type { Receive , Send , Synchronizer } from '../index.d.ts' ;
34import type { MergeableStore } from '../../mergeable-store/index.d.ts' ;
4- import type { Synchronizer } from '../index.d.ts' ;
55
66/// BroadcastChannelSynchronizer
77export interface BroadcastChannelSynchronizer extends Synchronizer {
@@ -13,5 +13,7 @@ export interface BroadcastChannelSynchronizer extends Synchronizer {
1313export function createBroadcastChannelSynchronizer (
1414 store : MergeableStore ,
1515 channelName : string ,
16+ onSend ?: Send ,
17+ onReceive ?: Receive ,
1618 onIgnoredError ?: ( error : any ) => void ,
1719) : BroadcastChannelSynchronizer ;
Original file line number Diff line number Diff line change 11/// synchronizer-broadcast-channel
22
3+ import type { Receive , Send , Synchronizer } from '../../with-schemas/index.d.ts' ;
34import type { MergeableStore } from '../../../mergeable-store/with-schemas/index.d.ts' ;
45import type { OptionalSchemas } from '../../../store/with-schemas/index.d.ts' ;
5- import type { Synchronizer } from '../../with-schemas/index.d.ts' ;
66
77/// BroadcastChannelSynchronizer
88export interface BroadcastChannelSynchronizer < Schemas extends OptionalSchemas >
@@ -17,5 +17,7 @@ export function createBroadcastChannelSynchronizer<
1717> (
1818 store : MergeableStore < Schemas > ,
1919 channelName : string ,
20+ onSend ?: Send ,
21+ onReceive ?: Receive ,
2022 onIgnoredError ?: ( error : any ) => void ,
2123) : BroadcastChannelSynchronizer < Schemas > ;
Original file line number Diff line number Diff line change 1- import type { Message , Receive } from '../../@types/synchronizers/index.d.ts' ;
1+ import type {
2+ Message ,
3+ Receive ,
4+ Send ,
5+ } from '../../@types/synchronizers/index.d.ts' ;
26import type { IdOrNull } from '../../@types/common/index.d.ts' ;
37import type { MergeableStore } from '../../@types/mergeable-store/index.d.ts' ;
48import type { createBroadcastChannelSynchronizer as createBroadcastChannelSynchronizerDecl } from '../../@types/synchronizers/synchronizer-broadcast-channel/index.d.ts' ;
@@ -9,6 +13,8 @@ import {isUndefined} from '../../common/other.ts';
913export const createBroadcastChannelSynchronizer = ( (
1014 store : MergeableStore ,
1115 channelName : string ,
16+ onSend ?: Send ,
17+ onReceive ?: Receive ,
1218 onIgnoredError ?: ( error : any ) => void ,
1319) => {
1420 const clientId = getUniqueId ( ) ;
@@ -41,6 +47,8 @@ export const createBroadcastChannelSynchronizer = ((
4147 registerReceive ,
4248 destroy ,
4349 0.01 ,
50+ onSend ,
51+ onReceive ,
4452 onIgnoredError ,
4553 { getChannelName : ( ) => channelName } ,
4654 ) ;
You can’t perform that action at this time.
0 commit comments