mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-24 02:51:17 -08:00
fix linting
This commit is contained in:
3 files changed
+16
-16
No files matched your search
@@ -165,9 +165,9 @@ export function ThemeImportModal({ open, onClose }: ThemeImportModalProps) {
|
||||
setImportFileName(file.name);
|
||||
setImportPaste('');
|
||||
const reader = new FileReader();
|
||||
reader.onload = () => {
|
||||
reader.addEventListener('load', () => {
|
||||
setUploadedFileCss(typeof reader.result === 'string' ? reader.result : '');
|
||||
};
|
||||
});
|
||||
reader.readAsText(file);
|
||||
};
|
||||
|
||||
|
||||
+11
-11
@@ -11,11 +11,11 @@ export type CachedThemeEntry = {
|
||||
function openDb(): Promise<IDBDatabase> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = indexedDB.open(DB_NAME, DB_VERSION);
|
||||
req.onerror = () => reject(req.error);
|
||||
req.onsuccess = () => resolve(req.result);
|
||||
req.onupgradeneeded = () => {
|
||||
req.addEventListener('error', () => reject(req.error));
|
||||
req.addEventListener('success', () => resolve(req.result));
|
||||
req.addEventListener('upgradeneeded', () => {
|
||||
req.result.createObjectStore(STORE, { keyPath: 'url' });
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -24,11 +24,11 @@ export async function getCachedThemeCss(url: string): Promise<string | undefined
|
||||
return new Promise((resolve, reject) => {
|
||||
const tx = db.transaction(STORE, 'readonly');
|
||||
const req = tx.objectStore(STORE).get(url);
|
||||
req.onerror = () => reject(req.error);
|
||||
req.onsuccess = () => {
|
||||
req.addEventListener('error', () => reject(req.error));
|
||||
req.addEventListener('success', () => {
|
||||
const row = req.result as CachedThemeEntry | undefined;
|
||||
resolve(row?.cssText);
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ export async function putCachedThemeCss(url: string, cssText: string): Promise<v
|
||||
return new Promise((resolve, reject) => {
|
||||
const tx = db.transaction(STORE, 'readwrite');
|
||||
tx.objectStore(STORE).put(entry);
|
||||
tx.oncomplete = () => resolve();
|
||||
tx.onerror = () => reject(tx.error);
|
||||
tx.addEventListener('complete', () => resolve());
|
||||
tx.addEventListener('error', () => reject(tx.error));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ export async function clearThemeCache(): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const tx = db.transaction(STORE, 'readwrite');
|
||||
tx.objectStore(STORE).clear();
|
||||
tx.oncomplete = () => resolve();
|
||||
tx.onerror = () => reject(tx.error);
|
||||
tx.addEventListener('complete', () => resolve());
|
||||
tx.addEventListener('error', () => reject(tx.error));
|
||||
});
|
||||
}
|
||||
@@ -31,8 +31,8 @@ export function getSableCssPackageKind(cssText: string): 'theme' | 'tweak' | 'un
|
||||
const end = cssText.indexOf('*/', start + 2);
|
||||
if (end === -1) break;
|
||||
const block = cssText.slice(start + 2, end);
|
||||
if (block.includes(META_TWEAK)) return 'tweak';
|
||||
if (block.includes(META_THEME)) return 'theme';
|
||||
if (block.indexOf(META_TWEAK) !== -1) return 'tweak';
|
||||
if (block.indexOf(META_THEME) !== -1) return 'theme';
|
||||
pos = end + 2;
|
||||
}
|
||||
return 'unknown';
|
||||
@@ -46,7 +46,7 @@ function extractBlockCommentContaining(cssText: string, marker: string): string
|
||||
const end = cssText.indexOf('*/', start + 2);
|
||||
if (end === -1) return '';
|
||||
const block = cssText.slice(start + 2, end);
|
||||
if (block.includes(marker)) {
|
||||
if (block.indexOf(marker) !== -1) {
|
||||
return block;
|
||||
}
|
||||
pos = end + 2;
|
||||
|
||||
Reference in new issue
Block a user