Skip to content

Instantly share code, notes, and snippets.

@d11e9
Last active October 22, 2015 12:24
Show Gist options
  • Save d11e9/5d9b6811b9fb854d93e9 to your computer and use it in GitHub Desktop.
Save d11e9/5d9b6811b9fb854d93e9 to your computer and use it in GitHub Desktop.
pebble-test.js
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