Skip to content

Instantly share code, notes, and snippets.

@Comandeer
Created January 8, 2015 22:22
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 Comandeer/e97b18e34b58e4a2645e to your computer and use it in GitHub Desktop.
Save Comandeer/e97b18e34b58e4a2645e to your computer and use it in GitHub Desktop.
Dead simple fireEvent function
function fireEvent(elem, type, data)
{
elem = elem || window;
type = type || 'custom';
data = data || {};
var event = new CustomEvent(type, {detail: data});
elem.dispatchEvent(event);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment