diff options
author | Sarven Capadisli <csarven@controlyourself.ca> | 2009-07-15 19:54:15 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@controlyourself.ca> | 2009-07-15 19:54:15 +0000 |
commit | 81e6500cb95dd43bd0bb8c0a97b59266b82ef2a0 (patch) | |
tree | 9af45b5253944a6dffd1f4dcaea287bdfd98b1f2 /plugins/Comet/cometupdate.js | |
parent | 0b44b252a0e7c27a909f4a8dd5f899c5190cfa83 (diff) | |
parent | 7724e8b6f107719320702e1513c0d175c29e8f2e (diff) |
Merge branch '0.8.x' of git@gitorious.org:laconica/mainline into 0.8.x
Diffstat (limited to 'plugins/Comet/cometupdate.js')
-rw-r--r-- | plugins/Comet/cometupdate.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/Comet/cometupdate.js b/plugins/Comet/cometupdate.js new file mode 100644 index 000000000..72cca004b --- /dev/null +++ b/plugins/Comet/cometupdate.js @@ -0,0 +1,30 @@ +// update the local timeline from a Comet server +// + +var CometUpdate = function() +{ + var _server; + var _timeline; + var _userid; + var _replyurl; + var _favorurl; + var _deleteurl; + var _cometd; + + return { + init: function(server, timeline, userid, replyurl, favorurl, deleteurl) + { + _cometd = $.cometd; // Uses the default Comet object + _cometd.init(server); + _server = server; + _timeline = timeline; + _userid = userid; + _favorurl = favorurl; + _replyurl = replyurl; + _deleteurl = deleteurl; + _cometd.subscribe(timeline, function(message) { RealtimeUpdate.receive(message.data) }); + $(window).unload(function() { _cometd.disconnect(); } ); + } + } +}(); + |