electron-store
Advanced tools
Comparing version 8.1.0 to 8.2.0
@@ -20,3 +20,3 @@ import {Except} from 'type-fest'; | ||
/** | ||
Simple data persistence for your [Electron](https://electronjs.org) app or module - Save and load user preferences, app state, cache, etc. | ||
Simple data persistence for your [Electron](https://electronjs.org) app or module - Save and load user settings, app state, cache, etc. | ||
*/ | ||
@@ -63,6 +63,8 @@ declare class ElectronStore<T extends Record<string, any> = Record<string, unknown>> extends Conf<T> { | ||
Open the storage file in the user's editor. | ||
Returns a promise that resolves when the editor has been opened, or rejects if it failed to open. | ||
*/ | ||
openInEditor(): void; | ||
openInEditor(): Promise<void>; | ||
} | ||
export = ElectronStore; |
@@ -76,4 +76,8 @@ 'use strict'; | ||
openInEditor() { | ||
shell.openPath(this.path); | ||
async openInEditor() { | ||
const error = await shell.openPath(this.path); | ||
if (error) { | ||
throw new Error(error); | ||
} | ||
} | ||
@@ -80,0 +84,0 @@ } |
{ | ||
"name": "electron-store", | ||
"version": "8.1.0", | ||
"description": "Simple data persistence for your Electron app or module - Save and load user preferences, app state, cache, etc", | ||
"version": "8.2.0", | ||
"description": "Simple data persistence for your Electron app or module - Save and load user settings, app state, cache, etc", | ||
"license": "MIT", | ||
@@ -13,2 +13,3 @@ "repository": "sindresorhus/electron-store", | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
@@ -15,0 +16,0 @@ "test": "xo && ava && tsd" |
# electron-store | ||
> Simple data persistence for your [Electron](https://electronjs.org) app or module - Save and load user preferences, app state, cache, etc | ||
> Simple data persistence for your [Electron](https://electronjs.org) app or module - Save and load user settings, app state, cache, etc | ||
Electron doesn't have a built-in way to persist user preferences and other data. This module handles that for you, so you can focus on building your app. The data is saved in a JSON file named config.json in [`app.getPath('userData')`](https://electronjs.org/docs/api/app#appgetpathname). | ||
Electron doesn't have a built-in way to persist user settings and other data. This module handles that for you, so you can focus on building your app. The data is saved in a JSON file named config.json in [`app.getPath('userData')`](https://electronjs.org/docs/api/app#appgetpathname). | ||
You can use this module directly in both the main and renderer process. For use in the renderer process only, you need to call `Store.initRenderer()` in the main process, or create a new Store instance (`new Store()`) in the main process. | ||
<br> | ||
--- | ||
<div align="center"> | ||
<p> | ||
<p> | ||
<sup> | ||
<a href="https://github.com/sponsors/sindresorhus">My open source work is supported by the community</a> | ||
</sup> | ||
</p> | ||
<sup>Special thanks to:</sup> | ||
<br> | ||
<br> | ||
<a href="https://standardresume.co/tech"> | ||
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="200"/> | ||
</a> | ||
</p> | ||
<br> | ||
<a href="https://keygen.sh"> | ||
<div> | ||
<img src="https://sindresorhus.com/assets/thanks/keygen-logo.svg" width="210" alt="Keygen"> | ||
</div> | ||
<b>A dead-simple software licensing and distribution API built for developers</b> | ||
</a> | ||
<br> | ||
</div> | ||
--- | ||
<br> | ||
## Install | ||
```sh | ||
npm install electron-store | ||
``` | ||
$ npm install electron-store | ||
``` | ||
@@ -133,2 +101,4 @@ *Requires Electron 11 or later.* | ||
**Important: I cannot provide support for this feature. It has some known bugs. I have no plans to work on it, but pull requests are welcome.** | ||
You can use migrations to perform operations to the store whenever a version is upgraded. | ||
@@ -413,2 +383,4 @@ | ||
Returns a promise that resolves when the editor has been opened, or rejects if it failed to open. | ||
### initRenderer() | ||
@@ -415,0 +387,0 @@ |
118
19876
460