events - Find when Javascript is paused (hard to summarize) -


i'm making little game out of javascript, , i'm little stuck. game 1 of virtual pets, have feed , stuff pet. now, have hunger system made every 3 seconds pet gets little more hungry. thing is, when close laptop, javascript isn't running. i'm doing getting date of last save , getting difference of current date when open laptop.

however, have no way of triggering above. need event recognizes when page comes next time.

if still don't understand i'm trying say, here's example: open page , close laptop. javascript has stopped. 30 minutes later, open , alert how long i've been gone. event can trigger alert?

btw, have tried using such things onload, onpageshow, etc. of them either trigger once if not @ all.

in advice put current date (like every 2 seconds). , when load page, refer data seeing how long you're been gone.

http://www.w3schools.com/jsref/event_onload.asp


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -