diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-01-07 10:13:02 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-01-07 10:13:02 +0900 |
| commit | 91503405b4e58cb9d39c0441d86ff540a27931e6 (patch) | |
| tree | 4c64371d1a88668e762733db1afaa3be7e284442 /packages/frontend/src/local-storage.ts | |
| parent | 13.0.0-beta.26 (diff) | |
| download | misskey-91503405b4e58cb9d39c0441d86ff540a27931e6.tar.gz misskey-91503405b4e58cb9d39c0441d86ff540a27931e6.tar.bz2 misskey-91503405b4e58cb9d39c0441d86ff540a27931e6.zip | |
refactor(client): typed localStorage
Diffstat (limited to 'packages/frontend/src/local-storage.ts')
| -rw-r--r-- | packages/frontend/src/local-storage.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/frontend/src/local-storage.ts b/packages/frontend/src/local-storage.ts new file mode 100644 index 0000000000..5286a6f3a7 --- /dev/null +++ b/packages/frontend/src/local-storage.ts @@ -0,0 +1,31 @@ +type Keys = + 'v' | + 'lastVersion' | + 'instance' | + 'account' | + 'accounts' | + 'lastUsed' | + 'lang' | + 'drafts' | + 'hashtags' | + 'wallpaper' | + 'theme' | + 'colorSchema' | + 'useSystemFont' | + 'fontSize' | + 'ui' | + 'locale' | + 'theme' | + 'customCss' | + 'message_drafts' | + 'scratchpad' | + `miux:${string}` | + `ui:folder:${string}` | + `themes:${string}` | + `aiscript:${string}`; + +export const miLocalStorage = { + getItem: (key: Keys) => window.localStorage.getItem(key), + setItem: (key: Keys, value: string) => window.localStorage.setItem(key, value), + removeItem: (key: Keys) => window.localStorage.removeItem(key), +}; |