Skip to content

Commit f673099

Browse files
committed
Minor cleanup.
1 parent 2373c23 commit f673099

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

browser-extension/src/entrypoints/background.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ export function handleCommentEvent(message: CommentEvent, sender: any): boolean
2727
sender.tab?.windowId
2828
) {
2929
if (message.type === 'ENHANCED') {
30-
const tab: Tab = {
31-
tabId: sender.tab.id,
32-
windowId: sender.tab.windowId,
33-
}
3430
const commentState: CommentState = {
3531
drafts: [],
3632
spot: message.spot,
37-
tab,
33+
tab: {
34+
tabId: sender.tab.id,
35+
windowId: sender.tab.windowId,
36+
},
3837
}
3938
openSpots.set(message.spot.unique_key, commentState)
4039
} else if (message.type === 'DESTROYED') {
@@ -52,10 +51,7 @@ export function handlePopupMessage(
5251
sendResponse: (response: any) => void,
5352
): typeof CLOSE_MESSAGE_PORT | typeof KEEP_PORT_OPEN {
5453
if (isGetOpenSpotsMessage(message)) {
55-
const spots: CommentState[] = []
56-
for (const [, commentState] of openSpots) {
57-
spots.push(commentState)
58-
}
54+
const spots: CommentState[] = Array.from(openSpots.values())
5955
const response: GetOpenSpotsResponse = { spots }
6056
sendResponse(response)
6157
return KEEP_PORT_OPEN

0 commit comments

Comments
 (0)