TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How Custom Javascript Events Will Save the Universe

2 pointsby mcxxalmost 15 years ago

1 comment

klsalmost 15 years ago
I agree using a pub / sub event model can help to decouple a UI and allow developers to build components that can be dropped in pages. For example I use event models to notify widgets that new data is available. If someone changes their account information I publish an account changed message and any subscribers are get the new data and are responsible for updating their UI. Further the one I love to use it for is analytical. When you write widgets that you will use over and over again, I never know what analytical library that a company will be using so setting all my track-able events up as event publishes allows me to write a module that can subscribe to the events and publish the data to Omniture, Unica, Google or whoever. This decouples the two and allows the analytical to be layered on after the fact.