From 08b10746b5c6414eb2d853ebdf39844294482c97 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Sun, 14 Apr 2024 23:23:14 +0800 Subject: [PATCH] handle the processing in another module --- scripts/outside/processor.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 scripts/outside/processor.js diff --git a/scripts/outside/processor.js b/scripts/outside/processor.js new file mode 100644 index 0000000..d63b278 --- /dev/null +++ b/scripts/outside/processor.js @@ -0,0 +1,22 @@ +/* processor.js +Process the information on the website and display it on screen. +*/ + +// const inject = ((await import(chrome.runtime.getURL("scripts/outside/inject.js"))).default); +const scraper = (await import(chrome.runtime.getURL("scripts/outside/scraper.js"))).default; + +export default class processor { + #filter; + + async scrape (fields) { + this.data = new scraper ((fields) ? fields : this.targets); + console.log(this.data); + } + + constructor (filter) { + this.#filter = filter; + + this.targets = this.#filter[`data`]; + this.scrape(); + } +} \ No newline at end of file