feat: add basic joox support

(cherry picked from commit 699333ca06526d747a7eb4a188e896de81e9f014)
This commit is contained in:
鲁树人
2021-12-19 23:03:46 +00:00
parent 9add76c060
commit 1e7116a3a9
13 changed files with 207 additions and 16 deletions

View 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));
}
}