allow poll to be disabled

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@374056 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gregory John Wilkins 2006-02-01 12:10:51 +00:00
parent 5a429d90bb
commit e439b35bf2
2 changed files with 8 additions and 8 deletions

View File

@ -1,9 +1,4 @@
// -----------------
// Original code by Joe Walnes
// -----------------
var connection = null;
var chatTopic = "topic://CHAT.DEMO"; var chatTopic = "topic://CHAT.DEMO";
var chatMembership = "topic://CHAT.DEMO"; var chatMembership = "topic://CHAT.DEMO";

View File

@ -3,6 +3,7 @@
// AMQ handler // AMQ handler
var amq = var amq =
{ {
poll: true,
_first: true, _first: true,
_pollEvent: function(first) {}, _pollEvent: function(first) {},
_handlers: new Array(), _handlers: new Array(),
@ -70,10 +71,13 @@ var amq =
this._queueMessages=false; this._queueMessages=false;
if (this._messages==0) if (this._messages==0)
new Ajax.Request('/amq', { method: 'get', onSuccess: amq._pollHandler }); {
if (amq.poll)
new Ajax.Request('/amq', { method: 'get', onSuccess: amq._pollHandler });
}
else else
{ {
var body = this._messageQueue+'&poll=true'; var body = this._messageQueue+'&poll='+amq.poll;
this._messageQueue=''; this._messageQueue='';
this._messages=0; this._messages=0;
new Ajax.Request('/amq', { method: 'post', onSuccess: amq._pollHandler, postBody: body }); new Ajax.Request('/amq', { method: 'post', onSuccess: amq._pollHandler, postBody: body });
@ -123,7 +127,8 @@ var amq =
_startPolling : function() _startPolling : function()
{ {
new Ajax.Request('/amq', { method: 'get', parameters: 'timeout=0', onSuccess: amq._pollHandler }); if (amq.poll)
new Ajax.Request('/amq', { method: 'get', parameters: 'timeout=0', onSuccess: amq._pollHandler });
} }
}; };