Skip to content

Instantly share code, notes, and snippets.

@neopunisher
Created October 14, 2022 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neopunisher/768cd2e88aa2aaf006d62a432f3b6b9c to your computer and use it in GitHub Desktop.
Save neopunisher/768cd2e88aa2aaf006d62a432f3b6b9c to your computer and use it in GitHub Desktop.
document.addEventListener('yourCustomEvent', function (e) {
var data = e.detail;
console.log('received', data);
});
var data = {
allowedTypes: 'those supported by structured cloning, see the list below',
inShort: 'no DOM elements or classes/functions',
};
document.dispatchEvent(new CustomEvent('yourCustomEvent', { detail: data }));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment