信号和槽与事件和事件监听器

发布于 2024-09-17 12:23:46 字数 170 浏览 2 评论 0原文

开门见山!

  1. 信号/槽和事件/事件监听器如何比较?
  2. 有什么优点和缺点吗?
  3. 我应该考虑哪一个?为什么?

提前致谢!

Straight to the point!

  1. How do signals/slots and event/event-listeners compare?
  2. Are there any pros and cons?
  3. Which one should I consider and why?

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

古镇旧梦 2024-09-24 12:23:46

我的一般方法是在单个应用程序中使用事件/监听器,它们确实高效且快速,并且 IDE 有很多工具,使它们相对容易实现。如果您确实需要确保侦听器每次都能收到事件通知,我的经验法则是使用此模式。

我在 SOA 应用程序或系统集成中使用信号/槽模式,因为它是一种更加延迟友好且无状态的方法。

My general approach is to use Events/Listeners inside a single app, they are really efficient and fast, and IDEs have lots of tooling that makes them relatively easy to implement. My rule of thumb would be to use this pattern if you really need to be sure the listener gets notified of the event every time.

I use a signals/slots pattern in SOA applications or systems integration, since it is a more lag-friendly and stateless approach.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文