electron-userland / electron-json-storage

:package: Easily write and read user settings in Electron apps
1.43k stars 79 forks source link

Multiple Instances #85

Closed johnbwoodruff closed 6 years ago

johnbwoodruff commented 6 years ago

I have a use case where I want to have essentially multiple instances of this library, because I want to store various json files in various locations. With the single instance I have to always set the data path immediately before running the command, but that's not perfect in case I have two async tasks running and I end up with a race condition error. I couldn't find anything in the documentation about creating new instances of this library, with each instance having its own data path.

jviotti commented 6 years ago

Hi @jbw91 ,

Check https://github.com/electron-userland/electron-json-storage/pull/87. I added a way to pass a custom data path in all functions, which should do the trick!

jviotti commented 6 years ago

Check v3.2.0 on npm!

johnbwoodruff commented 6 years ago

Check v3.2.0 on npm!

@jviotti Looks like 3.2.0 isn't published to npm yet. Got an ETA on that?

jviotti commented 6 years ago

Oops, looks like I forgot about it. I should be good now!