function restoreSettings() {
  var base_currency, coin_one, coin_two, coin_three;
  try{
    base_currency = (JSON.parse(settingsStorage.getItem("base"))).values[0].name;
    if(base_currency == ""){
      base_currency == undefined
    }
    
    coin_one = (JSON.parse(settingsStorage.getItem("coin_one"))).values[0].name;
    coin_two = (JSON.parse(settingsStorage.getItem("coin_two"))).values[0].name;
    coin_three = (JSON.parse(settingsStorage.getItem("coin_three"))).values[0].name;
  }catch(e){
    coin_one=null;
    coin_two=null;
    coin_three=null;
  }
  
  if(coin_one==null||coin_two==null||coin_three==null){
    console.log("Coins are not defined in the settings.");
    sendVal({error:true, message:"coins_not_defined"});
  }else{
    console.log("Retrieving data from CoinMarketCap.");
    fetchData(base_currency, coin_one, coin_two, coin_three);
    //var interval = setInterval(function(){ fetchData(base_currency, coin_one, coin_two, coin_three) }, 30000);
  }
}
// Restore any previously saved settings and send to the device
Restore any previously saved settings and send to the device
Restore any previously saved settings and send to the device
function restoreSettings() {
  var base_currency, coin_one, coin_two, coin_three;
  try{
    base_currency = (JSON.parse(settingsStorage.getItem("base"))).values[0].name;
    if(base_currency == ""){
      base_currency == undefined
    }
    coin_one = (JSON.parse(settingsStorage.getItem("coin_one"))).values[0].name;
    coin_two = (JSON.parse(settingsStorage.getItem("coin_two"))).values[0].name;
    coin_three = (JSON.parse(settingsStorage.getItem("coin_three"))).values[0].name;
  }catch(e){
    coin_one=null;
    coin_two=null;
    coin_three=null;
  }
  if(coin_one==null||coin_two==null||coin_three==null){
    console.log("Coins are not defined in the settings.");
    sendVal({error:true, message:"coins_not_defined"});
  }else{
    console.log("Retrieving data from CoinMarketCap.");
    fetchData(base_currency, coin_one, coin_two, coin_three);
  }
}
function restoreSettings ( ) { var base_currency , coin_one , coin_two , coin_three ; try { base_currency = ( JSON . parse ( settingsStorage . getItem ( "base" ) ) ) . values [ 0 ] . name ; if ( base_currency == "" ) { base_currency == undefined } coin_one = ( JSON . parse ( settingsStorage . getItem ( "coin_one" ) ) ) . values [ 0 ] . name ; coin_two = ( JSON . parse ( settingsStorage . getItem ( "coin_two" ) ) ) . values [ 0 ] . name ; coin_three = ( JSON . parse ( settingsStorage . getItem ( "coin_three" ) ) ) . values [ 0 ] . name ; } catch ( e ) { coin_one = null ; coin_two = null ; coin_three = null ; } if ( coin_one == null || coin_two == null || coin_three == null ) { console . log ( "Coins are not defined in the settings." ) ; sendVal ( { error : true , message : "coins_not_defined" } ) ; } else { console . log ( "Retrieving data from CoinMarketCap." ) ; fetchData ( base_currency , coin_one , coin_two , coin_three ) ; } }
Restore any previously saved settings and send to the device
Restore any previously saved settings and send to the device
//var interval = setInterval(function(){ fetchData(base_currency, coin_one, coin_two, coin_three) }, 30000);