Don't use nonblock requests results if empty
This commit is contained in:
1 parent
fb9080c18a
commit
a26abd0dbb
1 file changed
+5
-2
@@ -122,9 +122,12 @@ var NotificationBase = new Class({
|
|||||||
startPoll: function(){
|
startPoll: function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
if(self.stopped || (self.request && self.request.isRunning()))
|
if(self.stopped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(self.request && self.request.isRunning())
|
||||||
|
self.request.cancel();
|
||||||
|
|
||||||
self.request = Api.request('nonblock/notification.listener', {
|
self.request = Api.request('nonblock/notification.listener', {
|
||||||
'onSuccess': function(json){
|
'onSuccess': function(json){
|
||||||
self.processData(json, false)
|
self.processData(json, false)
|
||||||
@@ -149,7 +152,7 @@ var NotificationBase = new Class({
|
|||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
// Process data
|
// Process data
|
||||||
if(json){
|
if(json && json.result){
|
||||||
Array.each(json.result, function(result){
|
Array.each(json.result, function(result){
|
||||||
App.trigger(result._t || result.type, [result]);
|
App.trigger(result._t || result.type, [result]);
|
||||||
if(result.message && result.read === undefined && !init)
|
if(result.message && result.read === undefined && !init)
|
||||||
|
|||||||
Reference in new issue
Block a user