modify entry func

This commit is contained in:
Gabe Yuan
2023-08-10 13:41:55 +08:00
parent 54ab126c64
commit 0616b4f221
3 changed files with 7 additions and 10 deletions

View File

@@ -6,19 +6,16 @@ import {
} from "./config";
import { getRules, matchRule } from "./libs";
import { getSetting } from "./libs";
import { fetchUpdate } from "./libs/fetch";
import { Translator } from "./libs/translator";
/**
* 入口函数
*/
(async () => {
const { fetchInterval, fetchLimit } = await getSetting();
fetchUpdate(fetchInterval, fetchLimit);
const setting = await getSetting();
const rules = await getRules();
const rule = matchRule(rules, document.location.href);
const translator = new Translator(rule);
const translator = new Translator(rule, setting);
// 监听消息
browser?.runtime.onMessage.addListener(async ({ action, args }) => {