add plugin support

pages^2
bat 3 years ago
parent 96c069fc8d
commit 1b081e0ef3

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

Loading…
Cancel
Save