#CustomEvent
Chrome extensions: a CustomEvent dispatched from the content script's isolated world runs the page's MAIN-world listener synchronously. If that listener replies with an event whose detail is a string, you get the MAIN-world result before dispatchEvent returns — I needed that inside pointerdown.
November 13, 2026 at 3:03 AM
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
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
Personally I’d recommend subclassing Event (or CustomEvent) instead of just defining a type!
June 19, 2025 at 1:22 PM
あれ引数付き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
Remix 3でpropsが変わった(=親がupdateした)時の処理が書きにくい問題について考えた結果、原因は親が子を自動的に再レンダリングするせいでは?と思った

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

具体的にはこんな感じ
メリットとして全ての処理が1つのイベントの中に集約され、不要な再レンダリングが起きないようになる
October 14, 2025 at 10:14 AM
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
Merged PR into main at bluesky-social/atproto: Provide a ponyfill for CustomEvent (#2710)
August 15, 2024 at 4:48 PM
Note: Icons need to be interactive

ᴛʜɪꜱ.ᴏɴᴄʟɪᴄᴋ = (ᴇᴠᴛ) => ᴅɪꜱᴘᴀᴛᴄʜᴇᴠᴇɴᴛ(
ɴᴇᴡ ᴄᴜꜱᴛᴏᴍᴇᴠᴇɴᴛ( ᴛʜɪꜱ.ɪꜱ ) ,
{ ʙᴜʙʙʟᴇꜱ: ᴛʀᴜᴇ, ᴄᴏᴍᴘᴏꜱᴇᴅ: ᴛʀᴜᴇ }
);

Keeps everything you need in one place/WebComponent
November 29, 2024 at 10:37 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
In your `State & Reactivity` section you mention using custom events. Your code uses `CustomEvent`. I'd recommend avoiding `CustomEvent` and consider sublcassing events, if you're not already. Check out justinfagnani.com/2025/06/25/s... for more.
Stop Using CustomEvent
justinfagnani.com
July 16, 2025 at 9:55 AM
You're just hijacking the eventing infra provided by this dom api, and only getting pub/sub out of it.

10/10 I've done it, works brilliantly. It's scalable, very focused, and no real 'catch' as the DX is quite nice with CustomEvent layered on top too.
November 13, 2025 at 7:08 PM
Feed: "Frontend Masters Boost RSS Feed"
By: Chris Coyier on Thursday, November 20, 2025
Stop Using CustomEvent
A satisfying little rant from Justin Fagnani: Stop Using CustomEvent. One point is that you’re forcing the consumer of the event to know that it’s custom and you have to get data out of the details pr...
frontendmasters.com
November 20, 2025 at 8:16 AM
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
Node.js v20.13.0リリース。
Bufferの`base64`と`base64url`のパフォーマンス改善、`CustomEvent`と`node --watch`をStableに変更、`fs/promises`のスタックトレースの追加など "Node.js — Node v20.13.0 (LTS)" https://nodejs.org/en/blog/release/v20.13.0 #nodejs #ReleaseNote
May 10, 2024 at 2:34 PM
JavaScriptでReactiveな処理をどう実装するかについて。
EventTargetとCustomEventを使ったPubSub/Observerパターン、Proxyを使ったリフアクティブなオブジェクト、Signal。
またDOMの`MutationObserver`や`IntersectionObserver`などAPIについて "Patterns for Reactivi…" https://frontendmasters.com/blog/vanilla-javascript-reactivity/
August 24, 2023 at 1:30 PM
My only disagreement with this article is: don't use CustomEvent. Just inherit from and extend Event.
April 13, 2025 at 9:50 PM