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
defaults not working #92
Comments
I have the same issue, I have defined cant provide a solution for now, just confirming |
quick and dirty workaround for now: const dotProp = require('dot-prop');
const storage = new Storage({
defaults
});
storage.getWorkaround = function (key, defaultValue) {
let v = storage.get(key, defaultValue);
return typeof v == "undefined" ? dotProp.get(storage._defaultValues, key, defaultValue) : v;
}; |
References But mainly: |
Thanks a lot, I get this solution. |
Please see my comment in the original issue:
Someone needs to do that. |
same bug guys |
As of 5.1.1 with electron 8.2.5, using the |
First, I set a defaults value when init the
Storage
object like this:this default values will be generated after my app launches for the first time.
but then, I modify
config.json
manually, delete the value for keyconfig.node
, save file.after that, content in config.json is:
then I launch my app,
storage.get("config.node")
return undefined, I think it will regenerate the default value after I delete them, but it doesn't.Is this a bug?
The text was updated successfully, but these errors were encountered: