Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs on accessing values with invoke/handle #110

Merged
merged 4 commits into from
May 5, 2020

Conversation

RobbieTheWagner
Copy link
Contributor

Closes #109

@@ -356,6 +356,21 @@ const store = new Store({
});
```

#### How do I get store values in the renderer process, when my store was setup in the main process?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would mention that it's recommended to adopt this pattern even if electron-store currently works directly in the renderer process as Electron plans to remove the remote module.

I would also link to my explanation on how to make a singleton. A singleton is still recommended, even for just the main process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sindresorhus I added a note about it being recommended to do it this way since remote will be removed. I am unsure where to add the link to your singleton instructions you mentioned. #15 just explains it is not a singleton, right?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it also explains how to make your own singleton. The The following a much safer and explicit pattern: part.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I added a note about #15. Any other changes necessary?

@sindresorhus sindresorhus changed the title Add accessing values with invoke/handle example Add docs on accessing values with invoke/handle May 5, 2020
@sindresorhus sindresorhus merged commit 1235c56 into sindresorhus:master May 5, 2020
@sindresorhus
Copy link
Owner

Thanks :)

@RobbieTheWagner RobbieTheWagner deleted the patch-1 branch May 5, 2020 15:23
@thehans
Copy link

thehans commented Mar 23, 2023

Is it possible at all to use IPC on/send instead of invoke/handle?

If so, could an example be provided for how that would work?
I'm trying to use electron-store as a replacement for localStorage, and having to change everything to promises is confounding me.

Edit: solution found and documented in the issue I created #252 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessing store from renderer
3 participants