JavaScript Custom Events

February 25, 2014

I have been googling around for how to pass custom event data into a JavaScript Event object. Turns out you can’t what you need to do is to use the realtively new object called CustomEvent.

var myCustomEvent = new CustomEvent('dtsn', customParam);

function eventHandler(e) {
	// will log out our customParam object
	console.log(e);
};

You can find out more information on the excellent MDN custom event page.

Comments

comments powered by Disqus