Skip to content

Commit 52b9532

Browse files
committed
(add) Logic in our onHover in backend(index.ts) to now appropriately highlight the DOM nodes from the front-end
Co-authored-by: Sanjay Lavingia <[email protected]>
1 parent d9b35a4 commit 52b9532

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,17 @@ window.addEventListener('message', ({ data: { action, payload } }: MsgData) => {
6060
break;
6161
case 'onHover':
6262

63-
63+
if(Array.isArray(payload)){
64+
for (let i=0; i<payload.length;i++){
65+
let element = document.getElementById(payload[i])
66+
if (element !== null) {
67+
element.style.backgroundColor = '#C0D9D9';
68+
setTimeout( () => {
69+
element.style.backgroundColor = "";
70+
}, 500)
71+
}
72+
}
73+
}
6474

6575
// if (payload !== null) {
6676
// let element = document.getElementById(payload)

0 commit comments

Comments
 (0)