can set global value to rules

This commit is contained in:
Gabe Yuan
2023-08-08 13:29:15 +08:00
parent 320b218c0a
commit 7f0b660716
8 changed files with 92 additions and 44 deletions

View File

@@ -40,7 +40,7 @@ export class Translator {
constructor(rule) {
this._rule = rule;
if (rule.transOpen) {
if (rule.transOpen === "true") {
this._register();
}
}
@@ -54,11 +54,11 @@ export class Translator {
};
toggle = () => {
if (this._rule.transOpen) {
this._rule.transOpen = false;
if (this._rule.transOpen === "true") {
this._rule.transOpen = "false";
this._unRegister();
} else {
this._rule.transOpen = true;
this._rule.transOpen = "true";
this._register();
}
};