How to use electron-settings - 10 common examples

To help you get started, we’ve selected a few electron-settings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bechbd / gremlin-ide / main.js View on Github external
// Open the DevTools automatically if developing
    if (dev) {
      mainWindow.webContents.openDevTools();
    }
  });

  // Emitted when the window is closed.
  mainWindow.on('closed', function () {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });

  //check for default settings
  if (!settings.has("loginInfo")) {
    console.log("No Settings exists, creating them")
    var setting = {
      serverName: "localhost",
      serverPort: 8182,
      userName: "",
      password: "",
      opProcessor: "",
      useSSL: false
    };
    settings.set("loginInfo", setting);
  } else {
    console.log("Settings Exist");
    console.log(settings.get("loginInfo"));
  }
}
github VertigoRay / GDAXBot / js / script.js View on Github external
function shouldBuy(product_id) {
    if (settings.get(product_id +'_buy_on_trend_long_up') && settings.get(product_id +'_buy_on_trend_short_up')) {
        // Buy only on trend up, BOTH
        return (varIsTrendingUp['long'][product_id] && varIsTrendingUp['short'][product_id]) ? true : false
    } else if (settings.get(product_id +'_buy_on_trend_long_up')) {
        // Buy only on trend up, LONG
        return (varIsTrendingUp['long'][product_id]) ? true : false
    } else if (settings.get(product_id +'_buy_on_trend_short_up')) {
        // Buy only on trend up, SHORT
        return (varIsTrendingUp['short'][product_id]) ? true : false
    } else {
        // Always buy
        return true
    }
}
github ebshimizu / stats-of-the-storm / js / index.js View on Github external
function loadDatabase() {
  if (!settings.has('dbPath')) {
    settings.set('dbPath', app.getPath('userData'));
  }

  if (!fs.existsSync(settings.get('dbPath'))) {
    showMessage('Reverted to Default DB Location', `Failed to load database at ${settings.get('dbPath')}. The Database location was reset. You may change the Database location in settings`, { sticky: true, class: 'negative' });
    settings.set('dbPath', app.getPath('userData'));
  }

  if (settings.get('completeDownload') === true) {
    setLoadMessage('Completing Download and Extraction of Online DB');
    finishCopyZipContents();
    settings.set('completeDownload', false);
  }

  const dbPath = settings.get('dbPath');
  console.log("Database loading from " + dbPath);
github tobias-klein / ezra-project / app / helpers / db_helper.js View on Github external
getDatabaseDir() {
    var databaseDir = this.userDataDir;
    
    if (settings.has('custom_database_dir') &&
      settings.get('custom_database_dir') != null) {

      databaseDir = settings.get('custom_database_dir');
      console.log('Using custom database dir ' + databaseDir + ' for database access!');
    } else {
      console.log('Using default database dir ' + databaseDir + ' for database access!');
    }

    return databaseDir;
  }
github dmooney65 / fmradio / app / src / settings / settings.js View on Github external
let generateDefaultSettings = () => {
        settings.set('sampleRate', 1140000);
        settings.set('stereo', true);
        settings.set('lastTuned', true);
        settings.set('localPlayer', true);
        settings.set('serverPort', 1337);
        settings.set('lastFrequency', '93200000');
        settings.set('ppm',0);
        settings.set('recordingsPath', app.getPath('music'));
        //var R4.set('name','BBC R4').set('freq',91000000)
        //console.log(settings.get('presets').length);
        settings = settings.set('offsetTuning', true);
    };
github alexanderepstein / Sandman / js / indexandpref.js View on Github external
function setPreferences() {
  document.getElementById("restartDiv").style.visibility = "visible";
  settings.set("militaryTime", (document.getElementById("timeType").checked).toString());
  settings.set("defaultTime", document.getElementById("defaultTime").value);
  settings.set("closeOnX", (document.getElementById("closeOnXcheck").checked).toString());
  settings.set("lagHours", document.getElementById("lagHours").value);
  settings.set("lagMinutes", document.getElementById("lagMinutes").value);
  settings.set("upTimeHours", document.getElementById("upTimeHours").value);
  settings.set("upTimeMinutes", document.getElementById("upTimeMinutes").value);
  settings.set("upTime", (document.getElementById("upTime").checked).toString());
  var tempstring = settings.get("closeOnX") + " Sandman";
  writeFile(tempstring);
  return;
  //console.log(settings.getAll());
}
github yjlintw / comic-reader / renderer-process / viewmodels / subscribe-viewmodel.js View on Github external
function register(host, titlekey, title, link, thumbnail_uri, subscribed=false) {
    let key_path = "comic." + host + "." + titlekey;
    if (!settings.has(key_path)) {
        settings.set(key_path, {
            "title": title,
            "link": link,
            "thumbnail": thumbnail_uri,
            "subscribed": subscribed,
            "lastread": "",
            "lastpage": "",
            "chapters": {},
            "chapters_count": 0,
            "newestchapter": "",
            "hasupdate": true
        });
    }
    return settings.get(key_path);
}
github yukimura1227 / reveal_lightning / index.js View on Github external
function setup_editor_theme() {
  if(!settings.has('editor.theme')) {
    settings.set('editor', { theme: 'twilight' });
  }
}
github dvx / lofi / src / renderer / components / Lofi / index.tsx View on Github external
constructor(props: any) {
    super(props);

    this.state = {
      access_token: settings.get('spotify.access_token'),
      refresh_token: settings.get('spotify.refresh_token'),
      window_side: SIDE.LEFT,
      auth: false,
    }
  }
github yjlintw / comic-reader / renderer-process / viewmodels / subscribe-viewmodel.js View on Github external
function hasSubscription() {
    all_comic_data = settings.get('comic');
    if (all_comic_data == undefined) return false;

    for (let host in all_comic_data) {
        for (let comic in all_comic_data[host]) {
            if (all_comic_data[host][comic].subscribed) {
                return true;
            }
        }
    }

    return false;
}

electron-settings

A simple and robust settings management library for Electron.

MIT
Latest version published 7 months ago

Package Health Score

58 / 100
Full package analysis