File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
packages/app-frontend/src/features/components/composable Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
- import { useBridge } from '@front/features/bridge'
1
+ import { getBridge } from '@front/features/bridge'
2
2
import { BridgeEvents } from '@vue-devtools/shared-utils'
3
3
import { Ref } from 'vue'
4
+ import throttle from 'lodash/throttle'
4
5
5
- export function useComponentHighlight ( id : Ref < string > ) {
6
- const { bridge } = useBridge ( )
6
+ const throttledSend = throttle ( ( id ?: string ) => {
7
+ if ( id ) {
8
+ getBridge ( ) . send ( BridgeEvents . TO_BACK_COMPONENT_MOUSE_OVER , id )
9
+ } else {
10
+ getBridge ( ) . send ( BridgeEvents . TO_BACK_COMPONENT_MOUSE_OUT )
11
+ }
12
+ } , 200 )
7
13
14
+ export function useComponentHighlight ( id : Ref < string > ) {
8
15
function highlight ( ) {
9
- bridge . send ( BridgeEvents . TO_BACK_COMPONENT_MOUSE_OVER , id . value )
16
+ throttledSend ( id . value )
10
17
}
11
18
12
19
function unhighlight ( ) {
13
- bridge . send ( BridgeEvents . TO_BACK_COMPONENT_MOUSE_OUT )
20
+ throttledSend ( null )
14
21
}
15
22
16
23
return {
You can’t perform that action at this time.
0 commit comments