Created
June 9, 2022 10:41
-
-
Save eduardoacskimlinks/ff3e9aa71ba7fcaef1a72fa50e059026 to your computer and use it in GitHub Desktop.
Runtime onMessage listener - servicer worker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { | |
if (sender.tab && request.type === DISABLE_ICON) { | |
setIconOff() | |
} | |
... | |
// Provide internationalization translations at content script request | |
if (sender.tab && request.type === "internationalization") { | |
// Extract language from user settings | |
const store = getStore() | |
const state = store.getState() | |
const language = userGetters.getUserLanguage(state) | |
// Return translations available | |
sendResponse(i18n.getDataByLanguage(language)) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment