In my chrome extension's content script following code is not working:
var myFunction = () => {
console.log("sending msg");
chrome.runtime.sendMessage({ action: "myAction" });
}
But when I convert the arrow function to classic JS function it worked.
function myFunction() {
console.log("sending msg");
chrome.runtime.sendMessage({ action: "myAction" });
}
Why arrow function is not working?