directly set the product's state

This commit is contained in:
buzz-lightsnack-2007 2024-05-05 09:05:08 +08:00
parent f7d5ccecb8
commit 0ff26c8bea

View file

@ -4,10 +4,8 @@ Process the information on the website and display it on screen.
import scraper from "/scripts/external/scraper.js";
import product from "/scripts/data/product.js";
import injection from "/scripts/GUI/entrypoints/inject.js"
import {global} from "/scripts/secretariat.js";
import logging from "/scripts/logging.js";
import pointer from "/scripts/data/pointer.js";
export default class processor {
#filter;
@ -23,11 +21,11 @@ export default class processor {
await this.product.analyze();
} catch(err) {
logging.error(err.name, err.message, err.stack, false);
this.notify({"error": true});
this.product.status[`error`] = true;
};
// Indicate that the process is done.
await this.notify({"done": true});
this.product.status[`done`] = true;
// Save the data.
this.product.save();
@ -51,13 +49,4 @@ export default class processor {
this.analyze();
}
}
/*
Use the storage data to notify about the processing updates.
*/
async notify (state) {
// Indicate that this is the last updated.
await pointer.select(this.URL);
pointer.update(state);
}
}