import everything instead of being inside settings

Pretty sure every key is important!
This commit is contained in:
buzz-lightsnack-2007 2024-03-28 11:18:22 +08:00
parent 5b06c3f967
commit 3930e06f2b

View file

@ -2,15 +2,13 @@
This does not stand for "FamiCom" but instead on Finalization and Completion. This script provides installation run scripts. This does not stand for "FamiCom" but instead on Finalization and Completion. This script provides installation run scripts.
*/ */
import {read, write, init} from './secretariat.js'; import { read, write, init } from "./secretariat.js";
let config = chrome.runtime.getURL('config/config.json'); let config = chrome.runtime.getURL("config/config.json");
export default class fc { export default class fc {
/* Start the out of the box experience. */ /* Start the out of the box experience. */
static hello() { static hello() {
// the OOBE must be in the config. // the OOBE must be in the config.
fetch(config) fetch(config)
.then((response) => response.json()) .then((response) => response.json())
@ -21,21 +19,20 @@ export default class fc {
configuration.forEach((item) => { configuration.forEach((item) => {
chrome.tabs.create({ url: item }, function (tab) {}); chrome.tabs.create({ url: item }, function (tab) {});
}); });
}; }
}) })
.catch((error) => { .catch((error) => {
console.error(error); console.error(error);
}); });
}; }
/* Initialize the configuration. */ /* Initialize the configuration. */
static setup() { static setup() {
// the OOBE must be in the config. // the OOBE must be in the config.
fetch(config) fetch(config)
.then((response) => response.json()) .then((response) => response.json())
.then((jsonData) => { .then((jsonData) => {
let configuration = jsonData[`settings`]; let configuration = jsonData;
// Run the storage initialization. // Run the storage initialization.
init(configuration); init(configuration);
@ -49,14 +46,13 @@ export default class fc {
chrome.runtime.onInstalled.addListener(function (details) { chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason == chrome.runtime.OnInstalledReason.INSTALL) { if (details.reason == chrome.runtime.OnInstalledReason.INSTALL) {
fc.hello(); fc.hello();
}; }
fc.setup(); fc.setup();
}); });
} }
/* main function */ /* main function */
static run() { static run() {
fc.trigger(); fc.trigger();
} }
} }