electron-window-manager
electron-window-manager copied to clipboard
fixed a bug of sharedData.fetch.
You can't use 0 / false for sharedData due to invalid check.
Currently the workaround is to provide altValue explicitly, such as
const d = windowmanager.sharedData.fetch('key', 0);
But of course, you may not use anything other than 0 / false as altValue if your value would have 0 or false.
(for instance, your value would be 0 ~ 100 and you want to give MAX_VALUE if the key doesn't exist --- you won't be able to solve this situation with the above workaround)
for some reason altValue is undocumented in the readme :/
the current behaviour is: a falsy value of referenced key returns the altValue
the source doc is the following:
- @param altValue The alternative value to return in case the passed key doesn't exist
so the condition actually should be (key in this.data) according to this, (allowing it to return different falsy values, including undefined)
but my concern is that changin the current logic can potentially break something that might depends on it