是否有像发布和订阅这样的东西与jquery一起使用,将消息从1个javascript页面发送到另一个页面。使用ajax发布和订阅背后的相同想法?
我想使用该模式在页面之间进行通信,我最近一直在使用 javascript 框架,但最近又转换回 jquery,并且很想继续使用它。
有什么想法我应该从哪里开始吗?如果存在超过 1 个,则使用哪个实现..
谢谢
Is there such a thing as publish and subscribe for use with jquery to send msgs from 1 javascript page to another.. Using the same idea behind ajax publish and subscribe?
I would like to use the pattern for communication between pages, i have been using a javascript framework lately but recently converted back to jquery and would love to continue using this.
Any ideas where i should start? and which implementation to use if more than 1 exists..
Thanks
发布评论
评论(5)
jQuery 是一个简单的 JS 工具包,使 DOM 的使用变得更加容易。
您需要的是类似 strope 的东西。它通过 XMPP “nofollow noreferrer”>BOSH。有一个视频,创建者在其中进行了描述。
另一种选择是 Bayeux 协议。 Dojo 和 jQuery 中有实现。
jQuery is a simple JS toolkit that makes working with the DOM easier.
What you need is something like strophe. It uses XMPP via BOSH. There is a video, where the creator describes it.
Another option is the Bayeux protocol. There are implementations in Dojo and jQuery.
jQuery 只是一个提供实用函数集的库。它不是一种编程语言。这不是阿贾克斯。
Ajax 是一种设计模式。它不是一种编程语言。它不是图书馆。
Ajax 发布-订阅只是使用 Ajax 模式的更具体的设计模式。
没有理由不能使用 jQuery 来实现。
jQuery is just a library providing set of utility functions. It is not a programming language. It is not Ajax.
Ajax is a design pattern. It is not a programming language. It is not a library.
Ajax publish-subscribe is just a more specific design pattern that uses the Ajax pattern.
There is no reason it can't be implemented using jQuery.
我认为您正在寻找用 jquery 编写的 bayeux 协议的实现。
使用 bayeux 协议的 comet 插件可以在这里找到
I think you're looking for an implementation of the bayeux protocol written in jquery.
A comet plugin that uses the bayeux protocol can be found here
您正在尝试使用观察者模式来同步 UI?
我认为这个应该对您有帮助
看看背后的代码
基本上,当您单击顶部的复选框时,链接的行为会发生变化
代码很小
我喜欢它
干杯
You are trying to use the observer pattern to synch the UI?
I think this should help you
Have a look at the code behind
basically when you click on the check boxes on top the behaviour of the link changes
the code is very small
I love it
Cheers
请查看 http://laharsub.codeplex.com。这是一个开源项目,它使用 HTTP API 提供发布/订阅功能,并附带一个 jQuery 扩展,为 Ajax 应用程序提供可用的 OM。
Check out http://laharsub.codeplex.com. This is an open source project that provides publish/subscribe capability using HTTP APIs and comes with a jQuery extension that provides usable OM for Ajax applications.