chrome-extension-cli
Version:
The CLI for your next Chrome Extension.
21 lines (17 loc) • 619 B
text/typescript
;
// With background scripts you can communicate with sidepanel
// and contentScript files.
// For more information on background script,
// See https://developer.chrome.com/extensions/background_pages
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.type === 'GREETINGS') {
const message: string =
"Hi Syd, my name is Bac. I am from Background. It's great to hear from you.";
// Log message coming from the `request` parameter
console.log(request.payload.message);
// Send a response message
sendResponse({
message,
});
}
});