Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'electron-store' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
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
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
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)
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
});
}
},
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)
export function getWalletCfg(testnet, walletPath) {
const config = new Store({ cwd: getWalletCfgPath(testnet, walletPath) });
return (config);
}
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,
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',
});
constructor() {
this.config = new ElectronStore<{}>({
name: "freeman.internal.state"
});
}