Socket
Socket
Sign inDemoInstall

electron-store

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-store - npm Package Compare versions

Comparing version 4.0.0 to 5.0.0

37

index.d.ts
/// <reference types="node"/>
import EventEmitter = require('events');
import {Omit} from 'type-fest';
import {Except} from 'type-fest';
import Conf = require('conf');
declare namespace ElectronStore {
type Options<T> = Omit<
type Schema = Conf.Schema;
type Options<T> = Except<
Conf.Options<T>,
'configName' | 'projectName' | 'projectSuffix'
'configName' | 'projectName' | 'projectVersion' | 'projectSuffix'
> & {

@@ -22,13 +24,27 @@ /**

declare class ElectronStore<T> extends Conf<T> {
/**
Simple data persistence for your [Electron](https://electronjs.org) app or module - Save and load user preferences, app state, cache, etc.
*/
declare class ElectronStore<T = any> extends Conf<T> {
/**
Simple data persistence for your [Electron](https://electronjs.org) app or module - Save and load user preferences, app state, cache, etc.
Changes are written to disk atomically, so if the process crashes during a write, it will not corrupt the existing store.
Changes are written to disk atomically, so if the process crashes during a write, it will not corrupt the existing config.
@example
```
import Store = require('electron-store');
const store = new Store();
type StoreType = {
isRainbow: boolean,
unicorn?: string
}
const store = new Store<StoreType>({
defaults: {
isRainbow: true
}
});
store.get('isRainbow');
//=> true
store.set('unicorn', '🦄');

@@ -38,7 +54,2 @@ console.log(store.get('unicorn'));

// Use dot-notation to access nested properties
store.set('foo.bar', true);
console.log(store.get('foo'));
//=> {bar: true}
store.delete('unicorn');

@@ -45,0 +56,0 @@ console.log(store.get('unicorn'));

{
"name": "electron-store",
"version": "4.0.0",
"version": "5.0.0",
"description": "Simple data persistence for your Electron app or module - Save and load user preferences, app state, cache, etc",

@@ -36,9 +36,9 @@ "license": "MIT",

"dependencies": {
"conf": "^5.0.0",
"type-fest": "^0.5.2"
"conf": "^6.0.0",
"type-fest": "^0.7.1"
},
"devDependencies": {
"ava": "^2.1.0",
"electron": "^5.0.5",
"execa": "^1.0.0",
"electron": "^6.0.7",
"execa": "^2.0.4",
"tsd": "^0.7.2",

@@ -45,0 +45,0 @@ "xo": "^0.24.0"

@@ -23,2 +23,3 @@ # electron-store [![Build Status](https://travis-ci.org/sindresorhus/electron-store.svg?branch=master)](https://travis-ci.org/sindresorhus/electron-store)

const Store = require('electron-store');
const store = new Store();

@@ -100,2 +101,31 @@

### migrations
Type: `object`
You can use migrations to perform operations to the store whenever a version is upgraded.
The `migrations` object should consist of a key-value pair of `version`: `handler`.
Example:
```js
const Store = require('electron-store');
const store = new Store({
migrations: {
'0.0.1': store => {
store.set('debug phase', true);
},
'1.0.0': store => {
store.delete('debug phase');
store.set('phase', '1.0');
},
'1.0.2': store => {
store.set('phase', '>1.0');
}
}
});
```
#### name

@@ -102,0 +132,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc