Skip to content

Instantly share code, notes, and snippets.

@tekwiz
Created July 24, 2024 19:43
Show Gist options
  • Save tekwiz/7a1dcfd84fa4eacdbac3804e48c9e2aa to your computer and use it in GitHub Desktop.
Save tekwiz/7a1dcfd84fa4eacdbac3804e48c9e2aa to your computer and use it in GitHub Desktop.
Log messages sent/received
window.addEventListener('message', function MessageLogger (o) {
console.debug('Message Origin:%s Data:%o', o.origin, o.data);
});
window.__postMessage = Window.prototype.postMessage;
Window.prototype.postMessage = function _postMessage () {
console.debug('PostMessage %o', Array.from(arguments));
window.__postMessage.apply(this, arguments);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment