Estoy tratando de usar javascript de vainilla para enviar un evento personalizado. Junto con el evento, me gustaría pasar un objeto personalizado.
Esto es lo que he hecho
document.addEventListener('abcAppended', function (e) { console.log(e.el); // write the custom object to the console }); var wrapper = document.getElementById('abc'); if (wrapper) { // do something with wrapper document.dispatchEvent(new CustomEvent('abcAppended', { el: wrapper // I tried to add custom object here })); } Pero lo anterior escribe undefined en la consola. ¿Cómo puedo pasar correctamente un objeto y acceder a él usando un oyente?