|
|
|
@ -27,9 +27,20 @@ class Session {
|
|
|
|
export class Storage {
|
|
|
|
export class Storage {
|
|
|
|
constructor() {
|
|
|
|
constructor() {
|
|
|
|
this.session = new Session()
|
|
|
|
this.session = new Session()
|
|
|
|
|
|
|
|
this.plugins = []
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addPlugin(plugin) {
|
|
|
|
|
|
|
|
this.plugins.push(plugin)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getItem(k) {
|
|
|
|
getItem(k) {
|
|
|
|
|
|
|
|
for (const plugin of this.plugins) {
|
|
|
|
|
|
|
|
const result = plugin(k)
|
|
|
|
|
|
|
|
if (result ?? undefined !== undefined) {
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return localStorage.getItem(k)
|
|
|
|
return localStorage.getItem(k)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|