Fix building
This commit is contained in:
parent
03dc3f34b0
commit
39e658a488
@ -111,7 +111,7 @@ interface SortedDialog extends SortedElementBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setPromiseMiddleware<T extends {[smth in K as K]?: CancellablePromise<void>}, K extends keyof T>(obj: T, key: K) {
|
function setPromiseMiddleware<T extends {[smth in K as K]?: CancellablePromise<void>}, K extends keyof T>(obj: T, key: K) {
|
||||||
const oldPromise = obj[key];
|
const oldPromise: CancellablePromise<void> = obj[key] as any;
|
||||||
if(oldPromise) {
|
if(oldPromise) {
|
||||||
oldPromise.reject();
|
oldPromise.reject();
|
||||||
}
|
}
|
||||||
@ -119,12 +119,12 @@ function setPromiseMiddleware<T extends {[smth in K as K]?: CancellablePromise<v
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const deferred = obj[key] = deferredPromise<void>();
|
const deferred = obj[key] = deferredPromise<void>();
|
||||||
deferred.catch(() => {}).finally(() => {
|
deferred.catch(() => {}).finally(() => {
|
||||||
if(obj[key] === deferred) {
|
if((obj[key] as any) === deferred) {
|
||||||
delete obj[key];
|
delete obj[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const middleware = middlewarePromise(() => obj[key] === deferred);
|
const middleware = middlewarePromise(() => (obj[key] as any) === deferred);
|
||||||
return {deferred, middleware};
|
return {deferred, middleware};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class LocalStorage<Storage extends Record<string, any>> {
|
|||||||
} else if(this.useStorage) {
|
} else if(this.useStorage) {
|
||||||
let value: Storage[T];
|
let value: Storage[T];
|
||||||
try {
|
try {
|
||||||
value = localStorage.getItem(this.prefix + key as string) as any;
|
value = localStorage.getItem(this.prefix + (key as string)) as any;
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
this.useStorage = false;
|
this.useStorage = false;
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ class LocalStorage<Storage extends Record<string, any>> {
|
|||||||
|
|
||||||
public delete(key: keyof Storage, saveLocal = false) {
|
public delete(key: keyof Storage, saveLocal = false) {
|
||||||
// ! it is needed here
|
// ! it is needed here
|
||||||
key = '' + key;
|
key = '' + (key as string);
|
||||||
|
|
||||||
if(!saveLocal) {
|
if(!saveLocal) {
|
||||||
delete this.cache[key];
|
delete this.cache[key];
|
||||||
@ -81,7 +81,7 @@ class LocalStorage<Storage extends Record<string, any>> {
|
|||||||
|
|
||||||
// if(this.useStorage) {
|
// if(this.useStorage) {
|
||||||
try {
|
try {
|
||||||
localStorage.removeItem(this.prefix + key);
|
localStorage.removeItem(this.prefix + (key as string));
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ export default class AppStorage<
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
// ! it is needed here
|
// ! it is needed here
|
||||||
key = '' + key;
|
key = '' + (key as string);
|
||||||
|
|
||||||
if(!saveLocal) {
|
if(!saveLocal) {
|
||||||
delete this.cache[key];
|
delete this.cache[key];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user