diff --git a/scripts/external/processor.js b/scripts/external/processor.js index 4a6986c..5e9117b 100644 --- a/scripts/external/processor.js +++ b/scripts/external/processor.js @@ -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(); + + } + + } } \ No newline at end of file