Skip to content

Commit 4f8403a

Browse files
committed
refactor(LocalStorageObjectProvider): use getItem() and setItem()
1 parent 9a1437a commit 4f8403a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/plugins/localStorage/LocalStorageObjectProvider.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ export default class LocalStorageObjectProvider {
7171
* @private
7272
*/
7373
persistSpace(space) {
74-
this.localStorage[this.spaceKey] = JSON.stringify(space);
74+
this.localStorage.setItem(this.spaceKey, JSON.stringify(space));
7575
}
7676

7777
/**
7878
* @private
7979
*/
8080
getSpace() {
81-
return this.localStorage[this.spaceKey];
81+
return this.localStorage.getItem(this.spaceKey);
8282
}
8383

8484
/**
@@ -93,14 +93,14 @@ export default class LocalStorageObjectProvider {
9393
*/
9494
initializeSpace() {
9595
if (this.isEmpty()) {
96-
this.localStorage[this.spaceKey] = JSON.stringify({});
96+
this.localStorage.setItem(this.spaceKey, JSON.stringify({}));
9797
}
9898
}
9999

100100
/**
101101
* @private
102102
*/
103103
isEmpty() {
104-
return this.getSpace() === undefined;
104+
return this.getSpace() === null;
105105
}
106106
}

0 commit comments

Comments
 (0)