From ccf45d454c68f7f667d07e0db608569e049ec285 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 26 Apr 2009 15:08:49 -0400 Subject: Lots of tweaking to make things work Did some tweaking and maneuvering to make things work. This version will now show a "notice received" alert box -- lots of progress! Had to test with Java server, not Python server. --- plugins/Comet/updatetimeline.js | 48 +++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'plugins/Comet/updatetimeline.js') diff --git a/plugins/Comet/updatetimeline.js b/plugins/Comet/updatetimeline.js index 6612b5116..7b22445e3 100644 --- a/plugins/Comet/updatetimeline.js +++ b/plugins/Comet/updatetimeline.js @@ -3,28 +3,34 @@ var updater = function() { - var _handshook = false; - var _connected = false; - var _cometd; + var _cometd; - return { - init: function() - { - _cometd = $.cometd; // Uses the default Comet object - _cometd.init(_timelineServer); - _cometd.subscribe(_timeline, this, receive); - $(window).unload(leave); - } - } + return { + init: function(server, timeline) + { + _cometd = $.cometd; // Uses the default Comet object + _cometd.setLogLevel('debug'); + _cometd.init(server); + _cometd.subscribe(timeline, receive); + $(window).unload(leave); + } + } - function leave() - { - _cometd.disconnect(); - } + function leave() + { + _cometd.disconnect(); + } - function receive(message) - { - var noticeItem = makeNoticeItem(message.data); - var noticeList = $('ul.notices'); - } + function receive(message) + { + alert("Received notice."); + var noticeItem = makeNoticeItem(message.data); + var noticeList = $('ul.notices'); + } + + function makeNoticeItem(data) + { + return ''; + } }(); + -- cgit v1.2.3-54-g00ecf