feat: implement progress bar (os-level API) for getting favorites
This commit is contained in:
parent
9a7bd1d688
commit
597f9aaee0
|
@ -41,6 +41,7 @@ export class NhentaiAppWindow extends SiteAppWindow implements INhentaiAppWindow
|
|||
await this.login();
|
||||
}
|
||||
|
||||
this._window?.setProgressBar(0, { mode: 'indeterminate' });
|
||||
const bookUrls: string[] = [];
|
||||
for await (const wc of this.getFavoritePageWebContentsGenerator()) {
|
||||
bookUrls.push(
|
||||
|
@ -52,8 +53,10 @@ export class NhentaiAppWindow extends SiteAppWindow implements INhentaiAppWindow
|
|||
|
||||
const readable = Readable.from(
|
||||
(async function* (thisArg): AsyncGenerator<IFavorite, undefined> {
|
||||
for (const bookUrl of bookUrls) {
|
||||
for (let i = 0; i < bookUrls.length; i++) {
|
||||
const bookUrl = bookUrls[i];
|
||||
yield await thisArg.getBookTorrent(bookUrl);
|
||||
thisArg._window?.setProgressBar(i / bookUrls.length);
|
||||
}
|
||||
return;
|
||||
})(this),
|
||||
|
|
Loading…
Reference in New Issue