Commit b76fe70 1 parent e1af8ed commit b76fe70 Copy full SHA for b76fe70
File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -30,5 +30,7 @@ export * from './User';
30
30
export * from './UserAvatar' ;
31
31
32
32
export * from './utils/event-broker' ;
33
+ export * from './utils/withEventBrokerDomHandlers' ;
34
+ export * from './utils/useEventBroker' ;
33
35
export * from './utils/useLayer' ;
34
36
export * from './utils/useVirtualElementRef' ;
Original file line number Diff line number Diff line change
1
+ import { useEffect } from 'react' ;
2
+ import { eventBroker , EventBrokerSubscription } from './event-broker' ;
3
+
4
+ export function useEventBroker ( subscription : EventBrokerSubscription , broker = eventBroker ) {
5
+ useEffect ( ( ) => {
6
+ broker . subscribe ( subscription ) ;
7
+ return ( ) => broker . unsubscribe ( subscription ) ;
8
+ } , [ broker , subscription ] ) ;
9
+ }
You can’t perform that action at this time.
0 commit comments