put net.js inside a proper module

This commit is contained in:
buzz-lightsnack-2007 2024-04-15 15:16:53 +08:00
parent b5bcb59de2
commit 429e5bd852

View file

@ -11,7 +11,8 @@ Download a file from the network or locally.
@param {boolean} STRICT strictly follow the file type provided @param {boolean} STRICT strictly follow the file type provided
@returns {Promise} the downloaded file @returns {Promise} the downloaded file
*/ */
export async function download(URL, TYPE, VERIFY_ONLY = false, STRICT = false) { export default class net {
static async download(URL, TYPE, VERIFY_ONLY = false, STRICT = false) {
const texts = (await import(chrome.runtime.getURL(`gui/scripts/read.js`))) const texts = (await import(chrome.runtime.getURL(`gui/scripts/read.js`)))
.default; .default;
const alerts = (await import(chrome.runtime.getURL(`gui/scripts/alerts.js`))).default; const alerts = (await import(chrome.runtime.getURL(`gui/scripts/alerts.js`))).default;
@ -47,4 +48,5 @@ export async function download(URL, TYPE, VERIFY_ONLY = false, STRICT = false) {
// Return the filter. // Return the filter.
return VERIFY_ONLY ? CONNECT.ok : DATA; return VERIFY_ONLY ? CONNECT.ok : DATA;
}
} }