I use window.postMessage in Chrome Extension Content script:\[code\]function() { window.addEventListener("message", function(event) { console.log(event); }, false); window.postMessage({ type: \"FROM_PAGE\"}, "*");}\[/code\]The abnormal behavior is that the first time I call this function, console print event once; the second time I call, console print twice; the third time, three times.
What's wrong with my code?
What's wrong with my code?