Skip to content

Commit

Permalink
refactor(LocalStorageObjectProvider): use getItem() and setItem()
Browse files Browse the repository at this point in the history
  • Loading branch information
ozyx committed Jan 17, 2024
1 parent 9a1437a commit 4f8403a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/plugins/localStorage/LocalStorageObjectProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ export default class LocalStorageObjectProvider {
* @private
*/
persistSpace(space) {
this.localStorage[this.spaceKey] = JSON.stringify(space);
this.localStorage.setItem(this.spaceKey, JSON.stringify(space));
}

/**
* @private
*/
getSpace() {
return this.localStorage[this.spaceKey];
return this.localStorage.getItem(this.spaceKey);
}

/**
Expand All @@ -93,14 +93,14 @@ export default class LocalStorageObjectProvider {
*/
initializeSpace() {
if (this.isEmpty()) {
this.localStorage[this.spaceKey] = JSON.stringify({});
this.localStorage.setItem(this.spaceKey, JSON.stringify({}));
}
}

/**
* @private
*/
isEmpty() {
return this.getSpace() === undefined;
return this.getSpace() === null;
}
}

0 comments on commit 4f8403a

Please sign in to comment.