Skip to content

Commit

Permalink
📝 Change wording and add links to Electron Website
Browse files Browse the repository at this point in the history
  • Loading branch information
BetaHuhn committed Jun 8, 2021
1 parent 797be0e commit d261180
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Persist and rehydrate the Vuex state in your Electron app.
- 🔨 **Customization** - *specify what [parts of your Vuex state](#only-partially-persist-state) you want to persist and [which mutations are allowed](#filter-mutations)*
- ♻️ **Migrations** - *the persisted state can be easily [migrated](#migration-between-versions) between different versions of your Electron app*
- 🔐 **Encryption** - *you can optionally [encrypt](#%EF%B8%8F-options) the storage file with a encryption key*
- ⚙️ **Electron main process** - *you can access the Vuex state and commit mutations/dispatch actions from the Electron main process*
- ⚙️ **Electron main process** - *access the state & commit mutations/dispatch actions from the [Electron main process](https://www.electronjs.org/docs/tutorial/quick-start#run-the-main-process)*

This library is a wrapper around [electron-store](https://github.com/sindresorhus/electron-store) to make it work directly with Vuex and offer additional features.

Expand Down Expand Up @@ -251,7 +251,7 @@ Don't store the key like this if security is of concern, the encryption key woul

### IPC Mode

If you want to access the state or commit mutations/dispatch actions from the Electron main process, you need to enable `ipc` mode.
If you want to access the state or commit mutations/dispatch actions from the [Electron main process](https://www.electronjs.org/docs/tutorial/quick-start#run-the-main-process), you need to enable `ipc` mode.

You can then use the `.getStoreFromRenderer()` method in the main process to listen for an IPC connection from the renderer. Once connected you can use the returned `.commit()` and `.dispatch()` methods like you would in a normal Vue Component. Calling `.getState()` returns a promise containing the current Vuex state.

Expand Down Expand Up @@ -283,6 +283,8 @@ store.dispatch(action, payload)
// Get the current Vuex State
const state = await store.getState()
```

> When you use `.getStoreFromRenderer()` you don't need to call `.initRenderer()`
</details>

Expand Down Expand Up @@ -586,7 +588,7 @@ The `state` parameter contains the persisted state before rehydration.

### Access the store from the Electron main process

If you enable the [`ipc` mode](#ipc-mode) you can access the state or commit mutations/dispatch actions from the Electron main process:
If you enable the [`ipc` mode](#ipc-mode) you can access the state or commit mutations/dispatch actions from the [Electron main process](https://www.electronjs.org/docs/tutorial/quick-start#run-the-main-process):

```js
import PersistedState from 'vuex-electron-store'
Expand All @@ -603,6 +605,8 @@ store.dispatch(action, payload)
const state = await store.getState()
```

> When you use `.getStoreFromRenderer()` you don't need to call `.initRenderer()`
---

## 💻 Development
Expand Down

0 comments on commit d261180

Please sign in to comment.