多种型号可以使用相同的turbo_stream_from标签吗?
对于具有多个turbo_stream_from
标签的应用程序,例如:
<%= turbo_stream_from "posts" %>
<div id="posts">...</div>
<%= turbo_stream_from "comments" %>
<div id="comments">...</div>
... and in post model...
broadcast_update_to "posts", target: self
.. and in the comments model...
broadcast_update_to "comments", target: self
将这两个流统一到一个共享流中是否有缺点?
<%= turbo_stream_from "unified_stream" %>
<div id="posts">...</div>
<div id="comments">...</div>
... in the post model ....
broadcast_update_to "unified_stream", target: self
.. in the comments model ..
broadcast_update_to "unified_stream", target: self
For applications with multiple turbo_stream_from
tags like so:
<%= turbo_stream_from "posts" %>
<div id="posts">...</div>
<%= turbo_stream_from "comments" %>
<div id="comments">...</div>
... and in post model...
broadcast_update_to "posts", target: self
.. and in the comments model...
broadcast_update_to "comments", target: self
Is there any downside to unifying those two streams into one shared stream?
<%= turbo_stream_from "unified_stream" %>
<div id="posts">...</div>
<div id="comments">...</div>
... in the post model ....
broadcast_update_to "unified_stream", target: self
.. in the comments model ..
broadcast_update_to "unified_stream", target: self
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论