Is there a way, with Chrome DevTools, to see what’s going on in a BroadcastChannel
other than attaching a message
event listener to it, so that I could see who’s postMessage
-ing what?
Asked
Active
Viewed 1,833 times
6

Paolo
- 20,112
- 21
- 72
- 113

Константин Ван
- 12,550
- 7
- 61
- 73
-
2No, there is none. – wOxxOm Dec 19 '19 at 04:31
1 Answers
6
The best solution I found was extending the prototype of postMessage
like this:
(function(postMessage) {
BroadcastChannel.prototype.postMessage = function (message) {
debugger;
postMessage.call(this, message);
};
}(BroadcastChannel.prototype.postMessage));
You can obviously replace the debugger
statement by something else like console.trace(message)
for example, than you get the callstack directly printed in the console.
I hopes this helps you.

scipper
- 2,944
- 3
- 22
- 45