This is an old thread, just to update it. I am adding another answer so that it makes sense to anyone.
initEvent () is deprecated. It is still supported in some browsers, but does not use it.
Better concise way to create such events
function fireEvent(target) { var event = new Event('build');
To add additional data to the event object, there is a CustomEvent interface, and the detail property can be used to transfer user data. For example, an event can be created as follows:
var event = new CustomEvent('build', { 'detail': target.dataset.time });
Link: Creating and triggering events
source share