diff --git a/lib/background.ts b/lib/background.ts index 13f2470..eb05cd3 100644 --- a/lib/background.ts +++ b/lib/background.ts @@ -667,7 +667,7 @@ locale.then(() => { await DB.init(); } catch (ex) { - console.error("dbinit", ex.toString(), ex.message, ex.stack, ex); + console.error("db init", ex.toString(), ex.message, ex.stack, ex); } await Prefs.set("last-run", new Date()); diff --git a/lib/manager/download.ts b/lib/manager/download.ts index f74a40a..140a3b8 100644 --- a/lib/manager/download.ts +++ b/lib/manager/download.ts @@ -16,7 +16,7 @@ import { DONE, FORCABLE, MISSING, - PAUSABLE, + PAUSEABLE, PAUSED, QUEUED, RUNNING, @@ -235,7 +235,7 @@ export class Download extends BaseDownload { } async pause(retry?: boolean) { - if (!(PAUSABLE & this.state)) { + if (!(PAUSEABLE & this.state)) { return; } @@ -277,7 +277,7 @@ export class Download extends BaseDownload { await downloads.cancel(id); } catch (ex) { - // ingored + // ignored } await new Promise(r => setTimeout(r, 1000)); try { @@ -285,7 +285,7 @@ export class Download extends BaseDownload { } catch (ex) { console.error(id, ex.toString(), ex); - // ingored + // ignored } } @@ -399,7 +399,7 @@ export class Download extends BaseDownload { } } - updatefromSuggestion(state: any) { + updateFromSuggestion(state: any) { const res: PrerollResults = {}; if (state.mime) { res.mime = state.mime; diff --git a/lib/manager/man.ts b/lib/manager/man.ts index 240187f..3d81d77 100644 --- a/lib/manager/man.ts +++ b/lib/manager/man.ts @@ -91,11 +91,11 @@ export class Manager extends EventEmitter { } Bus.onPort("manager", (port: Port) => { - const mport = new ManagerPort(this, port); + const managerPort = new ManagerPort(this, port); port.on("disconnect", () => { - this.ports.delete(mport); + this.ports.delete(managerPort); }); - this.ports.add(mport); + this.ports.add(managerPort); return true; }); Limits.on("changed", () => { @@ -126,7 +126,7 @@ export class Manager extends EventEmitter { // Do not wait for the scheduler this.resetScheduler(); - this.emit("inited"); + this.emit("initialized"); setTimeout(() => this.checkMissing(), MISSING_TIMEOUT); runtime.onUpdateAvailable.addListener(() => { if (this.running.size) { @@ -171,7 +171,7 @@ export class Manager extends EventEmitter { return; } try { - download.updatefromSuggestion(state); + download.updateFromSuggestion(state); } finally { const suggestion = {filename: download.dest.full}; @@ -358,8 +358,8 @@ export class Manager extends EventEmitter { this.startNext().catch(console.error); } else if (newState === RUNNING) { - // Usually we already added it. Buit if a user uses the built-in - // download manager to resart + // Usually we already added it. But if a user uses the built-in + // download manager to restart // a download, we have not, so make sure it is added either way this.running.add(download); } @@ -417,17 +417,18 @@ export class Manager extends EventEmitter { sorted(sids: number[]) { try { // Construct new items - const csids = new Map(this.sids); + const currentSids = new Map(this.sids); let items = mapFilterInSitu(sids, sid => { - const item = csids.get(sid); + const item = currentSids.get(sid); if (!item) { return null; } - csids.delete(sid); + currentSids.delete(sid); return item; }, e => !!e); - if (csids.size) { - items = items.concat(sort(Array.from(csids.values()), i => i.position)); + if (currentSids.size) { + items = items.concat( + sort(Array.from(currentSids.values()), i => i.position)); } this.items = items; this.setPositions(); diff --git a/lib/manager/state.ts b/lib/manager/state.ts index dd815a5..56efcb1 100644 --- a/lib/manager/state.ts +++ b/lib/manager/state.ts @@ -12,5 +12,5 @@ export const RETRYING = 1 << 7; export const RESUMABLE = PAUSED | CANCELED | RETRYING; export const FORCABLE = PAUSED | QUEUED | CANCELED | RETRYING; -export const PAUSABLE = QUEUED | CANCELED | RUNNING | RETRYING; +export const PAUSEABLE = QUEUED | CANCELED | RUNNING | RETRYING; export const CANCELABLE = QUEUED | RUNNING | PAUSED | DONE | MISSING | RETRYING; diff --git a/windows/manager/table.ts b/windows/manager/table.ts index 3d0def7..83e5c05 100644 --- a/windows/manager/table.ts +++ b/windows/manager/table.ts @@ -790,7 +790,7 @@ export class DownloadTable extends VirtualTable { const items = this.getSelectedItems(); const states = items.reduce((p, c) => p |= c.state, 0); - if (!(states & DownloadState.PAUSABLE)) { + if (!(states & DownloadState.PAUSEABLE)) { this.pauseAction.disabled = true; } @@ -828,7 +828,7 @@ export class DownloadTable extends VirtualTable { } pauseDownloads() { - const sids = this.getSelectedSids(DownloadState.PAUSABLE); + const sids = this.getSelectedSids(DownloadState.PAUSEABLE); if (!sids.length) { return; } diff --git a/windows/prefs.ts b/windows/prefs.ts index 3ca7126..b4bdab9 100644 --- a/windows/prefs.ts +++ b/windows/prefs.ts @@ -665,7 +665,7 @@ addEventListener("DOMContentLoaded", async () => { }); await saveCustomLocale(text); - if (confirm("Imported your file.\nWant to relaod the extension now?")) { + if (confirm("Imported your file.\nWant to reload the extension now?")) { runtime.reload(); } }