/* global Pebble navigator */
function pebbleSuccess(e) {
  // do nothing
}
function pebbleFailure(e) {
  console.error(e);
}

var reportPhoneBatt;

Pebble.addEventListener('ready', function(e) {
  if (navigator.getBattery) {
    navigator.getBattery().then(function (battery) {
      reportPhoneBatt = function () {
        Pebble.sendAppMessage({
          'PHONE_BATT_LEVEL': Math.floor(battery.level * 100),
          'PHONE_BATT_CHARGING': battery.charging ? 1 : 0
        }, pebbleSuccess, pebbleFailure);
      };
      battery.addEventListener('levelchange', reportPhoneBatt);
      battery.addEventListener('chargingchange', reportPhoneBatt);
    });
  } else {
    console.error('No navigator.getBattery');
  }
});
Pebble.addEventListener('appmessage', function(e) {
  if (e.payload.QUERY_PHONE_BATT && reportPhoneBatt) {
    return reportPhoneBatt();
  }
});
@@ -551,32 +551,120 @@
 r('levelchange',
+ function() %7B%0A        console.log('Level change: '+ (battery.level * 100) +'%25');%0A       
  reportPhoneBatt
@@ -659,24 +659,35 @@
 ortPhoneBatt
+();%0A      %7D
 );%0A      bat
@@ -809,16 +809,71 @@
 tery');%0A
+    console.error('User agent: '+navigator.userAgent);%0A
   %7D%0A%7D);%0A

Add some more logging