Commit 084b362
committed
Add better test for localStorage
Followup from #126
I added a mock `localStorage` for environments where localStorage isn't
available, and to remove the 'store' dependency.
I've been testing more with [Bun](https://bun.com/) and I found that there,
this code doesn't reliably create the mock.
I guess in Node trying to access `window.localStorage` would throw an exception,
but that's not necessarily the case in other JS runtimes.
This commit changes it to use the `if (!('localStorage' in globalThis))` syntax,
which should work more reliably everywhere.1 parent afa6afd commit 084b362
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
0 commit comments