web-shared-preferences-fs-pollyfill
Version:
Pollyfill to use SharedPreferences outside of browsers
32 lines (21 loc) • 958 B
Markdown
Pollyfill to use SharedPreferences outside of browsers.
> I know, it should be an "polyfill", ignore my type mistake
[](https://www.npmjs.com/package/web-shared-preferences-fs-pollyfill)
[](https://www.npmjs.com/package/web-shared-preferences-fs-pollyfill)

```shell
bun add web-shared-preferences-fs-pollyfill
```
> There is currently no support for React as useString or something!
```ts
const pref = new SharedPreferences(new SharedPreferencesFsPollyfill("./local.json"));
pref.setString("name", "Kevin");
pref.setString("last", "Olaf");
pref.setJSON("json", {
name: "Hellow",
});
console.log(`${pref.getString("name", null)} (${pref.getString("last", "")})`);
```