Correct async calls to init scrapers

This commit is contained in:
Wolfsblvt 2024-09-29 11:27:07 +02:00
parent ab83138b1e
commit cc527a3a33
2 changed files with 10 additions and 10 deletions

View File

@ -959,7 +959,7 @@ async function firstLoadInit() {
initCfg();
initLogprobs();
initInputMarkdown();
initScrapers();
await initScrapers();
doDailyExtensionUpdatesCheck();
await hideLoader();
await fixViewport();

View File

@ -37,14 +37,14 @@ export class ScraperManager {
* Register a scraper to be used by the Data Bank.
* @param {Scraper} scraper Instance of a scraper to register
*/
static registerDataBankScraper(scraper) {
static async registerDataBankScraper(scraper) {
if (ScraperManager.#scrapers.some(s => s.id === scraper.id)) {
console.warn(`Scraper with ID ${scraper.id} already registered`);
return;
}
if (scraper.init) {
scraper.init();
await scraper.init();
}
ScraperManager.#scrapers.push(scraper);
@ -571,11 +571,11 @@ class YouTubeScraper {
}
}
export function initScrapers() {
ScraperManager.registerDataBankScraper(new FileScraper());
ScraperManager.registerDataBankScraper(new Notepad());
ScraperManager.registerDataBankScraper(new WebScraper());
ScraperManager.registerDataBankScraper(new MediaWikiScraper());
ScraperManager.registerDataBankScraper(new FandomScraper());
ScraperManager.registerDataBankScraper(new YouTubeScraper());
export async function initScrapers() {
await ScraperManager.registerDataBankScraper(new FileScraper());
await ScraperManager.registerDataBankScraper(new Notepad());
await ScraperManager.registerDataBankScraper(new WebScraper());
await ScraperManager.registerDataBankScraper(new MediaWikiScraper());
await ScraperManager.registerDataBankScraper(new FandomScraper());
await ScraperManager.registerDataBankScraper(new YouTubeScraper());
}