summaryrefslogtreecommitdiff
path: root/public/assets/js/nav.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-03-31 18:36:32 +0200
committerJules Laplace <julescarbon@gmail.com>2018-03-31 18:36:32 +0200
commitb9bf1b369aaef86d1f2d4dd2bf7f7fbe4bc1e9e8 (patch)
tree0a61c694c9e0eb62995ed3f08c635c28518dafe8 /public/assets/js/nav.js
parent89f3dcb22f20d6914e451d4a2c6caa20d8e4969e (diff)
better refresh
Diffstat (limited to 'public/assets/js/nav.js')
-rw-r--r--public/assets/js/nav.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/public/assets/js/nav.js b/public/assets/js/nav.js
index 247ed05..d1d9083 100644
--- a/public/assets/js/nav.js
+++ b/public/assets/js/nav.js
@@ -1,3 +1,5 @@
+var deferTimeout
+
var NavView = View.extend({
el: "body",
@@ -94,6 +96,11 @@ var NavView = View.extend({
this.fetching = true
this.onLatest = false
console.log('fetch ascii')
+ clearTimeout(deferTimeout)
+ deferTimeout = setTimeout(function(){
+ this.fetchAscii()
+ }.bind(this), 45000)
+
$.get("/p/get/randomascii", function(data){
// console.log(data)
var asciiData = {
@@ -107,6 +114,7 @@ var NavView = View.extend({
if (loaded) return
loaded = true
this.display(asciiData)
+ clearTimeout(deferTimeout)
setTimeout(this.fetchAscii.bind(this), 15000)
}.bind(this)
img.onerror = function(){