TLDR Web Dev · ARTICLES & TUTORIALS
STOP USING CUSTOMEVENT
Summary from the TLDR Web Dev newsletter
Devs should avoid using CustomEvent in JavaScript and instead subclass the native Event class. CustomEvent was only created because subclassing native classes wasn't well-supported when it was introduced, and it forces developers to deal with the awkward `detail` property to access event data. Event subclasses provide cleaner APIs, better TypeScript support, serve as documentation, and guarantee consistent event creation.