How to use electron-store - 10 common examples

To help you get started, we’ve selected a few electron-store 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 josephpei / uv2ray / src / render / store.js View on Github external
STORE_KEY_WIN_THEME,
} from './constants'
import Store from 'electron-store'

Vue.use(Vuex)

// 当前编辑的配置项
const editingConfig = new Config()
// v2ray config 有效key
const configKeys = Object.keys(editingConfig)
// 页面
const views = ['Feature', 'Setup', 'ManagePanel', 'Options']
// 编辑组的名称
let groupTitleBak = ''
// 功能页面是否已展示过
const ls = new Store()
// window.localStorage
// const featureReaded = !!ls.getItem(STORE_KEY_FEATURE)
const featureReaded = !!ls.get(STORE_KEY_FEATURE)

// 初始化读取存储,如果没有存储则保持
const storedSecurities = ls.get(STORE_KEY_V2RAY_SECURITIES)
const storedNetworks = ls.get(STORE_KEY_V2RAY_NETWORKS)
const storedTypes = ls.get(STORE_KEY_V2RAY_TYPES)
const storedTlses = ls.get(STORE_KEY_V2RAY_TLSES)
const storedTheme = ls.get(STORE_KEY_WIN_THEME)

let securities
let networks
let types
let tlses
// v2ray securities
github quantumkv / nighthawk / src / main / main.ts View on Github external
import createTray from './tray';
// tslint:disable-next-line:import-name
import createMainWindow from './window';
// tslint:disable-next-line:import-name
import registerShortcuts from './shortcuts';
import positioner from './positioner';
import electronStore from 'electron-store';
import electronLog from 'electron-log';

let mainWindow: Electron.BrowserWindow;
let tray: Electron.Tray;
let isDialogOpen: boolean = false;

electronLog.transports.file.level = 'warn';

let store = new electronStore({
    name: 'settings',
});

function createWindow() {
    // Create the browser window.
    mainWindow = createMainWindow();

    // attach tray to window
    tray = createTray(mainWindow);

    // Register Global Shortcuts
    registerShortcuts(mainWindow);

    if (
        !store.has('system.unobtrusive') ||
        store.get('system.unobtrusive') === true
github hello-efficiency-inc / ridereceipts / src / renderer / services / puppeteer_uberv2.js View on Github external
const chromeLauncher = require('chrome-launcher')
const request = require('request')
const util = require('util')
const PAGE_CLOSE = 'PAGE_CLOSE'
const EMAIL = 'EMAIL'
const PASSWORD = 'PASSWORD'
const VERIFICATION = 'VERIFICATION'
const FILTER_OPTION = 'FILTER_OPTION'
const INVOICE_COUNT = 'INVOICE_COUNT'
const GENERATE_LINKS = 'GENERATE_LINKS'
const DOWNLOADED = 'DOWNLOADED'
const ERROR_EMAIL = 'error-email'
const ERROR_PASS = 'error-pass'
const ERROR_CAPTCHA = 'CAPTCHA'
const ERROR_CAPTCHA_NOT_SOLVED = 'error-captcha'
const store = new Store()

// Listen to Event Once
async function listenEvent (eventname) {
  const data = new Promise((resolve, reject) => {
    ipcRenderer.once(eventname, (event, data) => {
      resolve(data)
    })
  })
  return data
}

// Get Solved Token
async function solveCaptcha (page) {
  // Get Recaptcha Key
  const siteToken = await page.evaluate(() => {
    const jsonData = JSON.parse(document.querySelector('#json-globals').innerHTML)
github wulkano / kap / app / src / main / share-service.js View on Github external
requiredKeys.push(key);
      }
    }

    const schema = {
      type: 'object',
      properties: schemaProps,
      required: requiredKeys
    };

    this.validateConfig = ajv.compile(schema);

    const defaults = {};
    this.validateConfig(defaults); // Adds defaults from schema

    this.config = new Store({
      name: this.pluginName,
      cwd: 'plugins',
      defaults
    });
  }
github MozillaSecurity / virgo / src / main / store.js View on Github external
},
    sentry: {
      dsn: 'https://165a946fbc3445aea4091b5e704e6a09@sentry.io/1459621'
    }
  }
}

/*
A new Virgo release might deprecate or introduce new settings.
* If we deprecate settings, then we need to detect those obsolete settings and remove them from
  the user's settings.
* If we introduce settings, then we need to merge those new settings but keep the user's set values
  for existing and non obsolete settings.
*/

const store = new Store({ defaults })

const migratePrefs = () => {
  const obsoletePrefs = JS.compareJSON(store.store.preferences, defaults.preferences)
  if (obsoletePrefs.length > 0) {
    logger.warning(
      'The following prefs are removed from your preferences because they are obsolete:'
    )
    logger.warning(JSON.stringify(obsoletePrefs))
    try {
      obsoletePrefs.forEach(pref => {
        logger.debug(`preferences.${pref}`)
        store.delete(`preferences.${pref}`)
      })
    } catch (error) {
      logger.error(error)
      process.exit(1)
github HcashOrg / hcGUI / app / config.js View on Github external
export function getWalletCfg(testnet, walletPath) {
  const config = new Store({ cwd: getWalletCfgPath(testnet, walletPath) });
  return (config);
}
github quantumkv / nighthawk / src / renderer / actions / SettingsActions.ts View on Github external
export function getSettings(): SettingsStoreModel {
    const store = new electronStore({
        name: 'settings',
        defaults: {
            library: {
                path: '',
                sortBy: 'artist',
                sortDirection: 'ASC',
            },
            player: {
                shuffle: false,
                repeat: false,
                volume: 1.0,
                mute: false,
            },
            system: {
                unobtrusive: true,
                zoomFactor: 1.0,
github r6db / app / packages / desktop / src / main / store.ts View on Github external
import Store from 'electron-store';
import { app } from 'electron';
import * as path from 'path';

export const store = new Store({
    cwd: path.resolve(app.getPath('documents'), 'r6db/'),
    fileExtension: 'r6db',
    encryptionKey: 'not for security, but to make it more annoying to tamper with',
});
github matthew-matvei / freeman / src / renderer / objects / Persister.ts View on Github external
constructor() {
        this.config = new ElectronStore<{}>({
            name: "freeman.internal.state"
        });
    }

electron-store

Simple data persistence for your Electron app or module - Save and load user settings, app state, cache, etc

MIT
Latest version published 9 days ago

Package Health Score

86 / 100
Full package analysis

Popular electron-store functions