Skip to content

Commit 0ddf33c

Browse files
committed
Enhance tab and window data structures in Chrome extension background
- Added 'lastAccessed' property to tab data for improved tracking of tab activity. - Included 'tabs' property in window data to provide context on the tabs within each window. - Updated messaging to reflect these changes for better data handling.
1 parent 5715930 commit 0ddf33c

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

chrome-extension/src/background/tabs.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ const all = () => {
2727
const title = tab?.title;
2828
const favIconUrl = tab?.favIconUrl;
2929
const windowId = tab?.windowId;
30+
const lastAccessed = tab?.lastAccessed;
3031
const data = {
3132
logic: 'tab_actived',
32-
tab: { id, url, title, favIconUrl, windowId },
33+
tab: { id, url, title, favIconUrl, windowId, lastAccessed },
3334
};
3435
ws?.send(JSON.stringify(data));
3536
});
@@ -42,7 +43,8 @@ const all = () => {
4243
const title = tab.title;
4344
const favIconUrl = tab.favIconUrl;
4445
const windowId = tab.windowId;
45-
return { id, url, title, favIconUrl, windowId };
46+
const lastAccessed = tab.lastAccessed;
47+
return { id, url, title, favIconUrl, windowId, lastAccessed };
4648
}),
4749
};
4850
ws?.send(JSON.stringify(data));

chrome-extension/src/background/windows.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const all = () => {
2929
const state = window?.state;
3030
const type = window?.type;
3131
const focused = window?.focused;
32+
const tabs = window?.tabs;
3233
const data = {
3334
logic: 'window_actived',
3435
window: { id, left, top, width, height, state, type, focused },
@@ -47,7 +48,8 @@ const all = () => {
4748
const state = window.state;
4849
const type = window.type;
4950
const focused = window.focused;
50-
return { id, left, top, width, height, state, type, focused };
51+
const tabs = window.tabs;
52+
return { id, left, top, width, height, state, type, focused, tabs };
5153
}),
5254
};
5355
ws?.send(JSON.stringify(data));

0 commit comments

Comments
 (0)