Skip to content

Commit 31b7f9d

Browse files
committed
add icons and disabled popup
1 parent 0e43090 commit 31b7f9d

File tree

13 files changed

+54
-30
lines changed

13 files changed

+54
-30
lines changed

build/webpack.prod.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,5 @@ module.exports = merge(common, {
66
mode: 'production',
77
optimization: {
88
minimize: false,
9-
splitChunks: {
10-
cacheGroups: {
11-
commons: {
12-
test: /[\\/]node_modules[\\/]/,
13-
name: 'vendors',
14-
chunks: 'all',
15-
minChunks: 3,
16-
},
17-
},
18-
},
199
},
2010
});
1.77 KB
Loading
7.26 KB
Loading
399 Bytes
Loading
1.02 KB
Loading
550 Bytes
Loading
1.63 KB
Loading
760 Bytes
Loading
2.57 KB
Loading

extensions/chrome/background/background.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ chrome.tabs.onRemoved.addListener(tabId => {
3737
});
3838

3939
chrome.runtime.onMessage.addListener((request, sender) => {
40+
if (request.type === 'REACT_CONTEXT_DEVTOOL_DETECTED') {
41+
setAppPopup(true, sender.tab.id);
42+
return;
43+
}
44+
4045
if (request.type === 'REACT_CONTEXT_DEVTOOL_POPUP_DATA_REQUEST') {
4146
chrome.runtime.sendMessage({
4247
type: 'REACT_CONTEXT_DEVTOOL_POPUP_DATA',
@@ -86,3 +91,19 @@ const saveCatchData = (dataToCatch, { id: tabId, title }) => {
8691
const getCatchData = tabId => {
8792
return catchData[tabId];
8893
};
94+
95+
const setAppPopup = (isActive, tabId) => {
96+
chrome.browserAction.setIcon({
97+
tabId,
98+
path: {
99+
'16': `assets/icons/icon16${isActive ? '' : '-disabled'}.png`,
100+
'32': `assets/icons/icon32${isActive ? '' : '-disabled'}.png`,
101+
'48': `assets/icons/icon48${isActive ? '' : '-disabled'}.png`,
102+
'128': `assets/icons/icon128${isActive ? '' : '-disabled'}.png`,
103+
},
104+
});
105+
chrome.browserAction.setPopup({
106+
tabId,
107+
popup: 'popup/popup.html',
108+
});
109+
}

0 commit comments

Comments
 (0)