Random typos etc
This commit is contained in:
parent
c540c1fc29
commit
3c644e615d
@ -16,7 +16,7 @@ import {
|
|||||||
DONE,
|
DONE,
|
||||||
FORCABLE,
|
FORCABLE,
|
||||||
MISSING,
|
MISSING,
|
||||||
PAUSABLE,
|
PAUSEABLE,
|
||||||
PAUSED,
|
PAUSED,
|
||||||
QUEUED,
|
QUEUED,
|
||||||
RUNNING,
|
RUNNING,
|
||||||
@ -235,7 +235,7 @@ export class Download extends BaseDownload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async pause(retry?: boolean) {
|
async pause(retry?: boolean) {
|
||||||
if (!(PAUSABLE & this.state)) {
|
if (!(PAUSEABLE & this.state)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ export class Download extends BaseDownload {
|
|||||||
await downloads.cancel(id);
|
await downloads.cancel(id);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
// ingored
|
// ignored
|
||||||
}
|
}
|
||||||
await new Promise(r => setTimeout(r, 1000));
|
await new Promise(r => setTimeout(r, 1000));
|
||||||
try {
|
try {
|
||||||
@ -285,7 +285,7 @@ export class Download extends BaseDownload {
|
|||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
console.error(id, ex.toString(), 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 = {};
|
const res: PrerollResults = {};
|
||||||
if (state.mime) {
|
if (state.mime) {
|
||||||
res.mime = state.mime;
|
res.mime = state.mime;
|
||||||
|
@ -91,11 +91,11 @@ export class Manager extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bus.onPort("manager", (port: Port) => {
|
Bus.onPort("manager", (port: Port) => {
|
||||||
const mport = new ManagerPort(this, port);
|
const managerPort = new ManagerPort(this, port);
|
||||||
port.on("disconnect", () => {
|
port.on("disconnect", () => {
|
||||||
this.ports.delete(mport);
|
this.ports.delete(managerPort);
|
||||||
});
|
});
|
||||||
this.ports.add(mport);
|
this.ports.add(managerPort);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
Limits.on("changed", () => {
|
Limits.on("changed", () => {
|
||||||
@ -126,7 +126,7 @@ export class Manager extends EventEmitter {
|
|||||||
// Do not wait for the scheduler
|
// Do not wait for the scheduler
|
||||||
this.resetScheduler();
|
this.resetScheduler();
|
||||||
|
|
||||||
this.emit("inited");
|
this.emit("initialized");
|
||||||
setTimeout(() => this.checkMissing(), MISSING_TIMEOUT);
|
setTimeout(() => this.checkMissing(), MISSING_TIMEOUT);
|
||||||
runtime.onUpdateAvailable.addListener(() => {
|
runtime.onUpdateAvailable.addListener(() => {
|
||||||
if (this.running.size) {
|
if (this.running.size) {
|
||||||
@ -171,7 +171,7 @@ export class Manager extends EventEmitter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
download.updatefromSuggestion(state);
|
download.updateFromSuggestion(state);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
const suggestion = {filename: download.dest.full};
|
const suggestion = {filename: download.dest.full};
|
||||||
@ -358,8 +358,8 @@ export class Manager extends EventEmitter {
|
|||||||
this.startNext().catch(console.error);
|
this.startNext().catch(console.error);
|
||||||
}
|
}
|
||||||
else if (newState === RUNNING) {
|
else if (newState === RUNNING) {
|
||||||
// Usually we already added it. Buit if a user uses the built-in
|
// Usually we already added it. But if a user uses the built-in
|
||||||
// download manager to resart
|
// download manager to restart
|
||||||
// a download, we have not, so make sure it is added either way
|
// a download, we have not, so make sure it is added either way
|
||||||
this.running.add(download);
|
this.running.add(download);
|
||||||
}
|
}
|
||||||
@ -417,17 +417,18 @@ export class Manager extends EventEmitter {
|
|||||||
sorted(sids: number[]) {
|
sorted(sids: number[]) {
|
||||||
try {
|
try {
|
||||||
// Construct new items
|
// Construct new items
|
||||||
const csids = new Map(this.sids);
|
const currentSids = new Map(this.sids);
|
||||||
let items = mapFilterInSitu(sids, sid => {
|
let items = mapFilterInSitu(sids, sid => {
|
||||||
const item = csids.get(sid);
|
const item = currentSids.get(sid);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
csids.delete(sid);
|
currentSids.delete(sid);
|
||||||
return item;
|
return item;
|
||||||
}, e => !!e);
|
}, e => !!e);
|
||||||
if (csids.size) {
|
if (currentSids.size) {
|
||||||
items = items.concat(sort(Array.from(csids.values()), i => i.position));
|
items = items.concat(
|
||||||
|
sort(Array.from(currentSids.values()), i => i.position));
|
||||||
}
|
}
|
||||||
this.items = items;
|
this.items = items;
|
||||||
this.setPositions();
|
this.setPositions();
|
||||||
|
@ -12,5 +12,5 @@ export const RETRYING = 1 << 7;
|
|||||||
|
|
||||||
export const RESUMABLE = PAUSED | CANCELED | RETRYING;
|
export const RESUMABLE = PAUSED | CANCELED | RETRYING;
|
||||||
export const FORCABLE = PAUSED | QUEUED | 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;
|
export const CANCELABLE = QUEUED | RUNNING | PAUSED | DONE | MISSING | RETRYING;
|
||||||
|
@ -790,7 +790,7 @@ export class DownloadTable extends VirtualTable {
|
|||||||
const items = this.getSelectedItems();
|
const items = this.getSelectedItems();
|
||||||
const states = items.reduce((p, c) => p |= c.state, 0);
|
const states = items.reduce((p, c) => p |= c.state, 0);
|
||||||
|
|
||||||
if (!(states & DownloadState.PAUSABLE)) {
|
if (!(states & DownloadState.PAUSEABLE)) {
|
||||||
this.pauseAction.disabled = true;
|
this.pauseAction.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -828,7 +828,7 @@ export class DownloadTable extends VirtualTable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pauseDownloads() {
|
pauseDownloads() {
|
||||||
const sids = this.getSelectedSids(DownloadState.PAUSABLE);
|
const sids = this.getSelectedSids(DownloadState.PAUSEABLE);
|
||||||
if (!sids.length) {
|
if (!sids.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -665,7 +665,7 @@ addEventListener("DOMContentLoaded", async () => {
|
|||||||
});
|
});
|
||||||
await saveCustomLocale(text);
|
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();
|
runtime.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user