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

Not required in electron apps anymore? #174

Open
anujdatar opened this issue Mar 25, 2021 · 4 comments
Open

Not required in electron apps anymore? #174

anujdatar opened this issue Mar 25, 2021 · 4 comments

Comments

@anujdatar
Copy link

anujdatar commented Mar 25, 2021

As of electron 12, this module may not be needed anymore. As far as my tests goes, just the basic conf module works just fine. electron.remote deprecation was fixed with ipc, but may be completely unnecessary. conf now gets the correct parentDir values when used with electron directly, unlike earlier versions.

I tested this with Electron on linux, using basic npm start, as an AppImage, and deb and snap packages. They all work fine with conf.

I have not tested with electron 11, this may be true for that as well.

@anujdatar anujdatar changed the title Not required Not required in electron apps anymore? Mar 25, 2021
@ivancuric
Copy link

I am just working on how to persist app data inside an electron app, and just came across both these packages and this issue. How is electron-store different from conf?

On conf's homepage it says:

It does not support multiple processes writing to the same store.
I initially made this tool to let command-line tools persist some data.

If you need this for Electron, check out electron-store instead.

but as far as I can see, the API is exactly the same, including both of them having the watch API.

@sindresorhus
Copy link
Owner

Some benefits of using electron-store store over conf:

  • It uses the correct config path for desktop apps. conf uses one that is correct for Node.js projects.
  • You don't have to manually specify the project name and version. (Conf will lose the ability to automatically fetch this info soon when it targets ESM).

@sindresorhus
Copy link
Owner

sindresorhus commented Apr 12, 2021

@ivancuric Multiple Electron processes and multiple Node.js processes are not the same. Electron does have multiple processes, but only one process, the main process, can write to the store directly. For Node.js, however, multiple independent processes could write to the store.

@ivancuric
Copy link

ivancuric commented Apr 13, 2021

only one process, the main process can write to the store directly

Would it be a good idea to expose electron-store directly in the renderer process via preload?

I am already using a global state management library, with some stores holding persistent/serializable data. It seems like a good idea to perhaps use electron-store as a middleware for that one, so I might as well skip the IPC messaging part.

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

No branches or pull requests

3 participants