#CustomEvent
After a new wave of discussion about CustomEvent vs Event subclasses, I wrote a new blog post on the topic:

TL;DR: Subclass Event instead of using CustomEvent 😎

justinfagnani.com/2025/06/25/s...
Stop Using CustomEvent
justinfagnani.com
June 25, 2025 at 2:56 PM
Said it before, will say it again:

CustomEvent is *criminally* under-utilized

developer.mozilla.org/en-US/docs/W...
CustomEvent: CustomEvent() constructor - Web APIs | MDN
The CustomEvent() constructor creates a new CustomEvent object.
developer.mozilla.org
April 8, 2025 at 4:42 PM
Personally I’d recommend subclassing Event (or CustomEvent) instead of just defining a type!
June 19, 2025 at 1:22 PM
Events generally (and not CustomEvent, extend Event if needed), or the event-based Context Protocol: github.com/webcomponent...
November 15, 2024 at 6:29 PM
JavaScript Tip 💡

Use 𝙲𝚞𝚜𝚝𝚘𝚖𝙴𝚟𝚎𝚗𝚝 for custom event dispatching and handling in the DOM.
February 1, 2025 at 4:00 PM
Another Q for the web component community--what are the best practices for emitting events? I see a split between preferring prefixing custom events or just emitting regular events.

Shoelace prefers custom events: CustomEvent('sl-open')
Other libs typically emits normal evs: Event('open')
March 10, 2025 at 4:36 PM
Guys its ready! the pride Capture The Flag event is now open on @skadegaming.com! Skader's can explore the lobby before the event and check out the cool features dotted around!

#Pride #Minecraft #MinecraftEvent #mc #CaptureTheFlag #PrideCaptureTheFlag #CustomEvent
June 27, 2025 at 5:34 PM
🚀 Calling all Developers! 💻 Ready to test your coding skills?

What is the correct way to emit an event from a child component in Vue 3 Composition API?
A) emitEvent('customEvent')
B) this.emit('customEvent')
C) emit('customEvent')
D) trigger('customEvent')

#TechQuiz #AI #Developer #VueJS
July 9, 2025 at 4:19 PM
One advice: don't use CustomEvent. Instead, extend the Event class and implement your custom logic there. CustomEvent is some backport hackery that was never meant to be used.
November 13, 2025 at 7:49 PM
Stop using CustomEvent in JavaScript.
There is a much better way to handle custom events.

#JavaScript #TypeScript #WebDev

1/5
September 10, 2026 at 8:02 PM
I'm not sure what the value-add is here for a component that side-steps both Event and CustomEvent, repeats the mistakes of CustomEvent, and doesn't do what the comment says it does (since bubble and compose are not provided as defaults).

github.com/umbraco/Umbr...
github.com
January 27, 2025 at 5:33 PM
cara, a maior parte da minha engine é esse código aqui:

const click = () => {
if (editor) {
const script = base + editor.getValue() + fim

const saida = eval(script) // <<=======

window.dispatchEvent(new CustomEvent("movimentos", { detail : {movimentos: saida }, bubbles: true}))
}
}
September 26, 2024 at 11:44 AM
I'm liking that more too, but decided to show the typed version first for 2 reasons:

1. I think CustomEvent tends to be the most common and is still a viable option
2. Teams may want to switch to subclassing, but may not be in a position to introduce breaking changes, but can update the types
June 19, 2025 at 2:39 PM
CustomEvent投げるの面白い "react-spectrum/packages/@react-spectrum/toast/src/ToastContainer.tsx at main · adobe/react-spectrum" https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/toast/src/ToastContainer.tsx
May 26, 2024 at 1:30 AM
🛠️ How to Create Custom Events in Business Central AL Code {Part 1} youtu.be/Riay2MqIwCA?... via @YouTube
#Msdyn365bc #CustomEvent #BCALHelp #ALHelp #BusinessCentral #IntegrationEvent #BusinessEvent #ALCode #IsHandled
🛠️ How to Create Custom Events in Business Central AL Code {Part 1}
YouTube video by saurav dhyani
youtu.be
February 26, 2025 at 8:10 AM
Remix 3でpropsが変わった(=親がupdateした)時の処理が書きにくい問題について考えた結果、原因は親が子を自動的に再レンダリングするせいでは?と思った

なので再レンダリングの代わりに親がupdateしたことを伝えるCustomEventをdispatchするようにしたらいいのではないかと思った

具体的にはこんな感じ
メリットとして全ての処理が1つのイベントの中に集約され、不要な再レンダリングが起きないようになる
October 14, 2025 at 10:14 AM
1. The problem with CustomEvent.
For years, developers used CustomEvent to pass data.

You must always wrap your data inside a detail property.

You cannot access your values directly.

It is also hard to type properly in TypeScript.

2/5
September 10, 2026 at 8:02 PM
Extending Event makes your code cleaner.

It makes your codebase easier to maintain.

Do you still use CustomEvent?
Or have you already switched to extending Event?

5/5
September 10, 2026 at 8:02 PM
Custom Events are so underused. I love them.
developer.mozilla.org/en-US/docs/W...
CustomEvent: CustomEvent() constructor - Web APIs | MDN
The CustomEvent() constructor creates a new CustomEvent object.
developer.mozilla.org
March 4, 2025 at 10:51 AM
あれ引数付きCustomEventってLive入ったんだっけ
July 2, 2025 at 7:58 AM
VRCで使えるすごいライトが増え
CustomEventで引数が使えるようになり
CyanTriggerが壊れた
May 24, 2025 at 12:07 PM
Udonに引数付きCustomEventが来るらしい、期待
April 24, 2025 at 10:58 PM
CustomEvent系、あくまでもその場にいる人に何かしら発火させるためのそれだから、late-joiner対応は別途状態保持用の変数と状態同期用のメソッドが必要がち
January 15, 2025 at 9:07 AM
Merged PR into main at bluesky-social/atproto: Provide a ponyfill for CustomEvent (#2710)
August 15, 2024 at 4:48 PM