import modules properly

This commit is contained in:
buzz-lightsnack-2007 2024-04-16 20:21:20 +08:00
parent d71e9effd0
commit 2b24bf17b0
2 changed files with 11 additions and 15 deletions

View file

@ -70,9 +70,6 @@ export default class logging {
@param {boolean} critical the critical nature @param {boolean} critical the critical nature
*/ */
static async error(ERROR_CODE, ERROR_MESSAGE, ERROR_STACK, critical = true) { static async error(ERROR_CODE, ERROR_MESSAGE, ERROR_STACK, critical = true) {
// Import the templating.
const texts = (await import(chrome.runtime.getURL("/scripts/strings/read.js"))).default;
// Display the error message. // Display the error message.
console.error(texts.localized(`error_msg`, false, [ERROR_CODE, ERROR_MESSAGE, ERROR_STACK])); console.error(texts.localized(`error_msg`, false, [ERROR_CODE, ERROR_MESSAGE, ERROR_STACK]));
if (critical) { if (critical) {

View file

@ -2,6 +2,10 @@
This script provides network utilities. This script provides network utilities.
*/ */
import texts from "/scripts/strings/read.js";
import logging from "/scripts/logging.js";
export default class net {
/* /*
Download a file from the network or locally. Download a file from the network or locally.
@ -11,12 +15,7 @@ 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 default class net {
static async download(URL, TYPE, VERIFY_ONLY = false, STRICT = false) { static async download(URL, TYPE, VERIFY_ONLY = false, STRICT = false) {
const texts = (await import(chrome.runtime.getURL(`/scripts/strings/read.js`)))
.default;
const logging = (await import(chrome.runtime.getURL(`/scripts/logging.js`))).default;
let CONNECT, DATA; let CONNECT, DATA;
try { try {