mirror of
https://git.um-react.app/um/web.git
synced 2025-12-16 12:13:02 +00:00
feat: add basic joox support
(cherry picked from commit 699333ca06526d747a7eb4a188e896de81e9f014)
This commit is contained in:
15
src/utils/storage/BrowserNativeStorage.ts
Normal file
15
src/utils/storage/BrowserNativeStorage.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import BaseStorage from './BaseStorage';
|
||||
|
||||
export default class BrowserNativeStorage extends BaseStorage {
|
||||
protected async load<T>(name: string, defaultValue: T): Promise<T> {
|
||||
const result = localStorage.getItem(name);
|
||||
if (result === null) {
|
||||
return defaultValue;
|
||||
}
|
||||
return JSON.parse(result);
|
||||
}
|
||||
|
||||
protected async save<T>(name: string, value: T): Promise<void> {
|
||||
localStorage.setItem(name, JSON.stringify(value));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user