update: zotero-types 0.1.5

This commit is contained in:
xiangyu 2023-01-06 12:53:20 +08:00
parent 398bf89a23
commit 5d3cde376d
2 changed files with 7 additions and 10 deletions

View File

@ -40,6 +40,6 @@
"esbuild": "^0.16.10", "esbuild": "^0.16.10",
"release-it": "^14.14.3", "release-it": "^14.14.3",
"replace-in-file": "^6.3.5", "replace-in-file": "^6.3.5",
"zotero-types": "^0.1.4" "zotero-types": "^0.1.5"
} }
} }

View File

@ -14,12 +14,12 @@ interface LineOptions {
idx?: number; idx?: number;
} }
// @ts-ignore
export class PopupWindow extends Zotero.ProgressWindow { export class PopupWindow extends Zotero.ProgressWindow {
private lines: _ZoteroItemProgress[]; private lines: _ZoteroItemProgress[];
private closeTime: number | undefined; private closeTime: number | undefined;
private originalShow: Function; private originalShow: typeof Zotero.ProgressWindow.prototype.show;
public show: typeof this.showWithTimer; // @ts-ignore
public show!: typeof this.showWithTimer;
constructor( constructor(
header: string, header: string,
@ -36,17 +36,14 @@ export class PopupWindow extends Zotero.ProgressWindow {
this.lines = []; this.lines = [];
this.closeTime = options.closeTime || 5000; this.closeTime = options.closeTime || 5000;
this.changeHeadline(header); this.changeHeadline(header);
// @ts-ignore this.originalShow = this
this.originalShow = this.show; .show as unknown as typeof Zotero.ProgressWindow.prototype.show;
this.show = this.showWithTimer; this.show = this.showWithTimer;
} }
createLine(options: LineOptions) { createLine(options: LineOptions) {
const icon = this.getIcon(options.type, options.icon); const icon = this.getIcon(options.type, options.icon);
const line = new this.ItemProgress( const line = new this.ItemProgress(icon || "", options.text || "");
icon || "",
options.text || ""
) as _ZoteroItemProgress;
if (typeof options.progress === "number") { if (typeof options.progress === "number") {
line.setProgress(options.progress); line.setProgress(options.progress);
} }