Last active
October 22, 2015 12:24
-
-
Save d11e9/5d9b6811b9fb854d93e9 to your computer and use it in GitHub Desktop.
pebble-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var count = parseInt(localStorage.getItem('count')) || 0; | |
var interval; | |
function tick (){ | |
simply.vibe('short'); | |
} | |
function render(){ | |
simply.text({ title: 'Test App', subtitle: "Vibrating every " + count + " seconds."}); | |
} | |
simply.on('singleClick', function(e) { | |
if (e.button === 'up') { | |
++count; | |
} else if (e.button === 'down') { | |
--count; | |
} | |
window.clearInterval( interval ); | |
interval = window.setInterval( tick, count*1000); | |
localStorage.setItem('count', count); | |
render() | |
}); | |
render(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment