mirror of
https://github.com/koel/koel
synced 2024-12-13 06:02:27 +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)
|
|
}
|