add function to analyze data as part of processing

This commit is contained in:
buzz-lightsnack-2007 2024-04-15 14:17:13 +08:00
parent 40e4818c67
commit 8cb7537463

View file

@ -4,18 +4,33 @@ Process the information on the website and display it on screen.
// const inject = ((await import(chrome.runtime.getURL("scripts/external/inject.js"))).default);
const scraper = (await import(chrome.runtime.getURL("scripts/external/scraper.js"))).default;
const product = (await import(chrome.runtime.getURL("scripts/product.js"))).default;
export default class processor {
#filter;
#filter;
async scrape (fields) {
this.data = new scraper ((fields) ? fields : this.targets);
console.log(this.data);
}
async analyze() {
this.product = new product(this.data);
await this.product.attach();
console.log(this.product);
console.log(await this.product.analyze());
}
constructor (filter) {
this.#filter = filter;
async scrape (fields) {
this.data = new scraper ((fields) ? fields : this.targets);
}
constructor (filter) {
this.#filter = filter;
this.targets = this.#filter[`data`];
this.scrape();
this.targets = this.#filter[`data`];
this.scrape();
}
if ((this.data) ? (((typeof (this.data)).includes(`obj`) && !Array.isArray(this.data)) ? Object.keys(this.data) : this.data) : false) {
this.analyze();
}
}
}