mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-16 00:54:12 +03:00
Reduce rendering count of visitors view
This commit is contained in:
parent
25c267f3df
commit
ee003d6336
@ -6,4 +6,4 @@
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
(function(b,e,f){b.Collections.Visitors=e.Collection.extend({model:b.Models.Visitor,initialize:function(){var a=b.Objects.Models.agent;b.Objects.server.callFunctionsPeriodically(function(){return[{"function":"currentTime",arguments:{agentId:a.id,"return":{time:"currentTime"},references:{}}},{"function":"updateVisitors",arguments:{agentId:a.id,"return":{visitors:"visitors"},references:{}}}]},f.bind(this.updateVisitors,this))},comparator:function(a){var c={field:a.get("firstTime").toString()};this.trigger("sort:field",
|
||||
a,c);return c.field},updateVisitors:function(a){if(0==a.errorCode){var c;c=a.currentTime?Math.round((new Date).getTime()/1E3)-a.currentTime:0;for(var d=0,b=a.visitors.length;d<b;d++)a.visitors[d].lastTime=parseInt(a.visitors[d].lastTime)+c,a.visitors[d].firstTime=parseInt(a.visitors[d].firstTime)+c;this.trigger("before:update:visitors",a.visitors);this.set(a.visitors);this.trigger("after:update:visitors")}}})})(Mibew,Backbone,_);
|
||||
a,c);return c.field},updateVisitors:function(a){if(0==a.errorCode){var c;c=a.currentTime?Math.round((new Date).getTime()/1E3)-a.currentTime:0;for(var d=0,b=a.visitors.length;d<b;d++)a.visitors[d].lastTime=parseInt(a.visitors[d].lastTime)+c,a.visitors[d].firstTime=parseInt(a.visitors[d].firstTime)+c;this.trigger("before:update:visitors",a.visitors);this.reset(a.visitors);this.trigger("after:update:visitors")}}})})(Mibew,Backbone,_);
|
||||
|
@ -64,7 +64,7 @@ b=[];this.set(a.threads,{remove:!1,sort:!1});b=this.filter(function(a){return a.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
(function(b,e,f){b.Collections.Visitors=e.Collection.extend({model:b.Models.Visitor,initialize:function(){var a=b.Objects.Models.agent;b.Objects.server.callFunctionsPeriodically(function(){return[{"function":"currentTime",arguments:{agentId:a.id,"return":{time:"currentTime"},references:{}}},{"function":"updateVisitors",arguments:{agentId:a.id,"return":{visitors:"visitors"},references:{}}}]},f.bind(this.updateVisitors,this))},comparator:function(a){var c={field:a.get("firstTime").toString()};this.trigger("sort:field",
|
||||
a,c);return c.field},updateVisitors:function(a){if(0==a.errorCode){var c;c=a.currentTime?Math.round((new Date).getTime()/1E3)-a.currentTime:0;for(var d=0,b=a.visitors.length;d<b;d++)a.visitors[d].lastTime=parseInt(a.visitors[d].lastTime)+c,a.visitors[d].firstTime=parseInt(a.visitors[d].firstTime)+c;this.trigger("before:update:visitors",a.visitors);this.set(a.visitors);this.trigger("after:update:visitors")}}})})(Mibew,Backbone,_);
|
||||
a,c);return c.field},updateVisitors:function(a){if(0==a.errorCode){var c;c=a.currentTime?Math.round((new Date).getTime()/1E3)-a.currentTime:0;for(var d=0,b=a.visitors.length;d<b;d++)a.visitors[d].lastTime=parseInt(a.visitors[d].lastTime)+c,a.visitors[d].firstTime=parseInt(a.visitors[d].firstTime)+c;this.trigger("before:update:visitors",a.visitors);this.reset(a.visitors);this.trigger("after:update:visitors")}}})})(Mibew,Backbone,_);
|
||||
/*
|
||||
Copyright 2005-2013 the original author or authors.
|
||||
Licensed under the Apache License, Version 2.0 (the "License").
|
||||
|
@ -102,7 +102,7 @@
|
||||
this.trigger('before:update:visitors', args.visitors);
|
||||
|
||||
// Update collection
|
||||
this.set(args.visitors);
|
||||
this.reset(args.visitors);
|
||||
|
||||
// Trigger event
|
||||
this.trigger('after:update:visitors');
|
||||
|
Loading…
Reference in New Issue
Block a user