fix(browser-extension): console warning for sync handlers

This commit is contained in:
wanhose 2022-12-01 16:57:38 +01:00
parent 96066a2cbd
commit 01fbdf6f45

View File

@ -99,13 +99,13 @@ chrome.runtime.onMessage.addListener((message, sender, callback) => {
break; break;
case 'GET_DATA': case 'GET_DATA':
storage.get('data', ({ data }) => (data ? callback(data) : refreshData(callback))); storage.get('data', ({ data }) => (data ? callback(data) : refreshData(callback)));
break; return true;
case 'GET_STATE': case 'GET_STATE':
if (hostname) storage.get(hostname, (state) => callback(state[hostname] ?? initial)); if (hostname) storage.get(hostname, (state) => callback(state[hostname] ?? initial));
break; return true;
case 'GET_TAB': case 'GET_TAB':
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => callback(tabs[0])); chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => callback(tabs[0]));
break; return true;
case 'INSERT_CONTENT_CSS': case 'INSERT_CONTENT_CSS':
if (tabId) script.insertCSS({ files: ['styles/content.css'], target: { tabId } }); if (tabId) script.insertCSS({ files: ['styles/content.css'], target: { tabId } });
break; break;
@ -121,8 +121,6 @@ chrome.runtime.onMessage.addListener((message, sender, callback) => {
default: default:
break; break;
} }
return true;
}); });
/** /**