From 9ca7fd9f0ed90e217e01741d903a9e357bf19c0b Mon Sep 17 00:00:00 2001 From: Peter Marquardt Date: Fri, 20 Nov 2015 20:49:25 +0100 Subject: [PATCH] added pebble-js-app.js in preparation for settings page --- src/js/pebble-js-app.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/js/pebble-js-app.js diff --git a/src/js/pebble-js-app.js b/src/js/pebble-js-app.js new file mode 100644 index 0000000..f80acd1 --- /dev/null +++ b/src/js/pebble-js-app.js @@ -0,0 +1,23 @@ +Pebble.addEventListener('ready', function() { + console.log('PebbleKit JS ready!'); +}); + +Pebble.addEventListener('showConfiguration', function() { + var url='http://pebble.lastfuture.de/config/supersimple13/'; + console.log('Showing configuration page: '+url); + Pebble.openURL(url); +}); + +Pebble.addEventListener('webviewclosed', function(e) { + var configData = JSON.parse(decodeURIComponent(e.response)); + console.log('Configuration page returned: '+JSON.stringify(configData)); + if (configData.colors) { + Pebble.sendAppMessage({ + colors: configData.colors + }, function() { + console.log('Send successful!'); + }, function() { + console.log('Send failed!'); + }); + } +}); \ No newline at end of file