How to use the electron-settings.has function in electron-settings

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 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 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' });
  }
}

electron-settings

A simple and robust settings management library for Electron.

MIT
Latest version published 14 days ago

Package Health Score

75 / 100
Full package analysis