add function to analyze data as part of processing
This commit is contained in:
parent
40e4818c67
commit
8cb7537463
1 changed files with 25 additions and 10 deletions
33
scripts/external/processor.js
vendored
33
scripts/external/processor.js
vendored
|
@ -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 inject = ((await import(chrome.runtime.getURL("scripts/external/inject.js"))).default);
|
||||||
const scraper = (await import(chrome.runtime.getURL("scripts/external/scraper.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 {
|
export default class processor {
|
||||||
#filter;
|
#filter;
|
||||||
|
|
||||||
async scrape (fields) {
|
async scrape (fields) {
|
||||||
this.data = new scraper ((fields) ? fields : this.targets);
|
this.data = new scraper ((fields) ? fields : this.targets);
|
||||||
}
|
console.log(this.data);
|
||||||
|
}
|
||||||
|
|
||||||
constructor (filter) {
|
async analyze() {
|
||||||
this.#filter = filter;
|
this.product = new product(this.data);
|
||||||
|
await this.product.attach();
|
||||||
|
console.log(this.product);
|
||||||
|
console.log(await this.product.analyze());
|
||||||
|
}
|
||||||
|
|
||||||
this.targets = this.#filter[`data`];
|
constructor (filter) {
|
||||||
this.scrape();
|
this.#filter = filter;
|
||||||
}
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue