From 4c2fec26f750e923577217c1b92daa08ec8a458a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 11 Dec 2015 04:35:49 -0600 Subject: improve loading and stuff. ios build 0.3.3 --- StoneIsland/www/js/index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'StoneIsland/www/js/index.js') diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index 0b3531dd..77f8a782 100755 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -64,6 +64,8 @@ var app = (function(){ app.ready = function(){ if (window.cordova) { + document.addEventListener('pause', app.paused, false) + document.addEventListener('resume', app.resumed, false) cordova.plugins.Keyboard.disableScroll(true) geo.fetch() } @@ -74,12 +76,26 @@ var app = (function(){ // app.router.launch() // } // else { - app.account.connect( app.router.launch.bind(app.router) ) + push.init() + app.account.connect( app.router.launch.bind(app.router) ) // } $("body").removeClass("loading") } + + var pause_time = 0 + app.paused = function(){ + + } + + app.resumed = function(){ + if (! pause_time) return + if (Date.now() - pause_time > 60 * 60 * 1000) { + app.blog.refresh() + } + } + return app })() -- cgit v1.2.3-70-g09d2