2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2022-10-18 15:40:47 +00:00
|
|
|
export default class Storage {
|
|
|
|
constructor(key, storage) {
|
|
|
|
this.key = key;
|
|
|
|
this.storage = storage;
|
|
|
|
|
|
|
|
this.state = this.initState(this.key, this.storage);
|
|
|
|
}
|
|
|
|
|
|
|
|
initState() {
|
|
|
|
const { key, storage } = this;
|
|
|
|
|
|
|
|
return storage.getItem(key);
|
|
|
|
}
|
|
|
|
}
|