diff options
author | Sean Whitton <spw+git@sdf.org> | 2014-11-12 15:27:29 +0900 |
---|---|---|
committer | Sean Whitton <spw+git@sdf.org> | 2014-11-12 15:27:29 +0900 |
commit | 57a1887df1e64c22034776c21b2823e29df735b6 (patch) | |
tree | d0ba8b3881f6d3c3702a2b2cdea56e8d806ee170 | |
parent | b6876287d35f63d1f4b7c477a60d6f5a2f5579c2 (diff) | |
download | schoolclock-57a1887df1e64c22034776c21b2823e29df735b6.tar.gz |
save time wasting clock to local storage each time it ticks
-rw-r--r-- | js/main.js | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3,7 +3,6 @@ * * - make all buttons work * - add all hotkeys - * - save time wasting time to local storage every tick * - rework use of global variables */ @@ -29,10 +28,14 @@ var timeWastingClock = new FlipClock($('.time-wasting-clock'), { callbacks:{ interval:function () { $.ionSound.play("button_tiny"); + var time = timeWastingClock.getTime().time; + $.jStorage.set("time_wasted", time); } } }); +timeWastingClock.setTime($.jStorage.get("time_wasted", 0)); + var $timeWastingClockRunning = false; var activityClock = new FlipClock($('.activity-countdown'), { @@ -85,6 +88,7 @@ function timeWastingClockReset() timeWastingClock.stop(); $timeWastingClockRunning = false; } + $.jStorage.set("time_wasted", 0); timeWastingClock.setTime(0); } } |