Example #1
0
function onSettingChange() {
  if (Options.getFeatures().enable_backlight && locked && !enabled) {
    enabled = true;
    Light.on();
  } else if (enabled) {
    enabled = false;
    Light.auto();
  }
}
Example #2
0
function enable() {
  locked = true;
  console.log("enable");
  if (Options.getFeatures().enable_backlight && !enabled) {
    enabled = true;
    console.log("light enabled");
    Light.on();
  }
}
Example #3
0
var countDown = function(i, uiCard, callback) {
  Light.on();
  
  // Must have this here otherwise it waits 1 second to update the Ui
  // because it immediately enters the setInterval
  uiCard.text(i);
  i--;
  
  refreshIntervalId = setInterval(function() {
      if (i >= 0) {
        uiCard.text(i);
        i--;
      } else {
        // clearInterval is working but is giving a warning in cloudPebble
        clearInterval(refreshIntervalId);
        Light.auto();
        console.log('Calling callback');
        callback();
      }
  }, 1000);
};