use a more efficient for loop and change CSS paths

This commit is contained in:
buzz-lightsnack-2007 2024-04-15 15:31:16 +08:00
parent 71c988fd52
commit 00e37a229d

View file

@ -19,19 +19,13 @@ export default class windowman {
// Prepare the window with its metadata. // Prepare the window with its metadata.
constructor() { constructor() {
async function headers() { function headers() {
let LOAD_STATE = true; let LOAD_STATE = true;
let UI = { let UI = {
CSS: [ CSS: [chrome.runtime.getURL("/styles/external/fonts/materialdesignicons.min.css"), chrome.runtime.getURL("/styles/external/materialize/css/materialize.css"), chrome.runtime.getURL("/styles/ui.css")]
chrome.runtime.getURL("/gui/styles/external/fonts/materialdesignicons.min.css"),
chrome.runtime.getURL("/gui/styles/external/materialize/css/materialize.css"),
chrome.runtime.getURL("/gui/styles/ui.css"),
]
}; };
for (let index = 0; index < UI[`CSS`].length; index++) { (UI[`CSS`]).forEach(async (source) => {
const source = UI.CSS[index];
try { try {
let resource = false; let resource = false;
@ -57,12 +51,9 @@ export default class windowman {
// Stop loading the page when an error has occured; it's not going to work! // Stop loading the page when an error has occured; it's not going to work!
if (!DEBUG) { if (!DEBUG) {
window.close(); window.close();
}
// Stop loading immediately during the error.
break;
}; };
} };
})
} }
// Get the window. // Get the window.