79753838

Date: 2025-09-02 18:47:08
Score: 0.5
Natty:
Report link

Here is how I got it to work.

$ npm install --save @types/chrome

In angular ts file:

///<reference types="chrome"/> // This might have to be the first line of the file

chrome.runtime.onMessage.addListener((event: any) => {
    const message = event.message;
            console.log('Message from parent:', message);
   }
});

In background service worker:
chrome.runtime.sendMessage({message: json_message});

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Rick