function restoreOptions() {

    // 1. Set defaults if there's nothing in the local storage yet
    function setCurrentChoice(result) {
        FormInputLocal.value = result.localhost || "http://localhost:8888";
        FormInputStaging.value = result.staging || "https://staging.yourdomain.com";
        FormInputProduction.value = result.www  || "https://www.yourdomain.com";
    }

    // 2. Print an error message to `about:devtools-toolbox`
    function onError(error) {
        console.log(`Error: ${error}`);
    }

    // 3. Get and set.
    var getting = browser.storage.sync.get();
        getting.then(setCurrentChoice, onError);

}
/**
 * Fetch from the local storage object and apply values back to the form
 */
Fetch from the local storage object and apply values back to the form
Fetch from the local storage object and apply values back to the form
function restoreOptions() {
    function setCurrentChoice(result) {
        FormInputLocal.value = result.localhost || "http://localhost:8888";
        FormInputStaging.value = result.staging || "https://staging.yourdomain.com";
        FormInputProduction.value = result.www  || "https://www.yourdomain.com";
    }
    function onError(error) {
        console.log(`Error: ${error}`);
    }
    var getting = browser.storage.sync.get();
        getting.then(setCurrentChoice, onError);
}
function restoreOptions ( ) { function setCurrentChoice ( result ) { FormInputLocal . value = result . localhost || "http://localhost:8888" ; FormInputStaging . value = result . staging || "https://staging.yourdomain.com" ; FormInputProduction . value = result . www || "https://www.yourdomain.com" ; } function onError ( error ) { console . log ( ` ${ error } ` ) ; } var getting = browser . storage . sync . get ( ) ; getting . then ( setCurrentChoice , onError ) ; }
Fetch from the local storage object and apply values back to the form
Fetch from the local storage object and apply values back to the form
// 1. Set defaults if there's nothing in the local storage yet // 2. Print an error message to `about:devtools-toolbox` // 3. Get and set.