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