I am trying to create a custom javascript event. The event works and fires correctly, but the \'detail\' object that I\'m passing it is not available.
Here\'s the code i
I found the following commit: https://github.com/jquery/jquery/commit/a90ff8c8c79bfcc32afd340a12f016f20a31d8b6
This fix is in jQuery's compat
branch and should be fixed as of jQuery 3.0.
obj.addEventListener("eventName", function(e) {
console.log(e.your_property)
})
var event = new CustomEvent("eventName");
event.your_property = { key: "value" };
obj.dispatchEvent(event);
You can create properties in your CustomEvent, when you dispatch you are sending it.
You need to access the originalEvent property for the details
console.log(e.originalEvent.detail);