summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/blogs/HubView.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2017-11-06 00:54:06 +0100
committerJules Laplace <julescarbon@gmail.com>2017-11-06 00:54:06 +0100
commit874448ba5fa8ff0796e9934c44eb8ba695c80257 (patch)
treecdcc640a7baf463a49bdc6099be4749789851aa9 /StoneIsland/www/js/lib/blogs/HubView.js
parent207a2d0d311fe602f81e594877bb0a996b01aa18 (diff)
check if hub needed..
Diffstat (limited to 'StoneIsland/www/js/lib/blogs/HubView.js')
-rwxr-xr-xStoneIsland/www/js/lib/blogs/HubView.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js
index 38a7eecf..d2d26787 100755
--- a/StoneIsland/www/js/lib/blogs/HubView.js
+++ b/StoneIsland/www/js/lib/blogs/HubView.js
@@ -22,6 +22,7 @@ var HubView = ScrollableView.extend({
this.deferScrollToTop()
app.footer.hide()
document.body.className = "hub"
+ HubLoader.isNeeded()
if (! this.populated) {
this.populate( BACKUP_DB.hub )
}
@@ -143,12 +144,13 @@ var HubLoader = (function(){
var count = 0
var HubLoader = {}
var loader
+ var needed = false
HubLoader.init = function(v){
view = v
}
HubLoader.add = function(items){
queue = items
- this.load()
+ HubLoader.load()
}
HubLoader.load = function(){
item = queue.shift()
@@ -167,10 +169,14 @@ var HubLoader = (function(){
HubLoader.build()
}
}
+ HubLoader.isNeeded = function(){
+ needed = true
+ }
HubLoader.build = function(){
view.append(item)
view.scroller.refresh()
- setTimeout(HubLoader.load, count < 4 ? 50 : 5000)
+ if (count === 3 && ! needed) return
+ setTimeout(HubLoader.load, count < 3 ? 1000 : 30000)
}
return HubLoader
})()