properly access static methods
This commit is contained in:
parent
ddaf8d4374
commit
7d0616add7
|
@ -22,7 +22,7 @@ class IAPIObject {
|
|||
static storage_key = undefined;
|
||||
|
||||
static _checkStorageSupport() {
|
||||
if (storage_key === undefined) {
|
||||
if (this.storage_key === undefined) {
|
||||
throw Error('This doesn\'t support local storage');
|
||||
}
|
||||
}
|
||||
|
@ -40,14 +40,18 @@ class IAPIObject {
|
|||
/** @returns {ThisType} */
|
||||
static restoreFromLocalStorage() {
|
||||
_checkStorageSupport();
|
||||
if (!window.localStorage.getItem(storage_key))
|
||||
if (!window.localStorage.getItem(this.storage_key))
|
||||
return false;
|
||||
return new APIToken(window.localStorage.getItem(storage_key));
|
||||
return new APIToken(window.localStorage.getItem(this.storage_key));
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
static isCached() {
|
||||
_checkStorageSupport();
|
||||
this._checkStorageSupport();
|
||||
if (window.localStorage.getItem(this.storage_key)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue