Browse Source

Fix building

master
Eduard Kuzmenko 2 years ago
parent
commit
39e658a488
  1. 6
      src/lib/appManagers/appDialogsManager.ts
  2. 6
      src/lib/localStorage.ts
  3. 2
      src/lib/storage.ts

6
src/lib/appManagers/appDialogsManager.ts

@ -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};
} }

6
src/lib/localStorage.ts

@ -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) {
} }

2
src/lib/storage.ts

@ -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…
Cancel
Save