mirror of
https://github.com/koel/koel
synced 2024-12-24 03:23:06 +00:00
12 lines
386 B
TypeScript
12 lines
386 B
TypeScript
import { get as baseGet, remove as baseRemove, set as baseSet } from 'local-storage'
|
|
|
|
export const localStorageService = {
|
|
get: <T> (key: string, defaultValue: T | null = null): T | null => {
|
|
const value = baseGet<T>(key)
|
|
|
|
return value === null ? defaultValue : value
|
|
},
|
|
|
|
set: (key: string, value: any) => baseSet(key, value),
|
|
remove: (key: string) => baseRemove(key)
|
|
}
|