Skip to content

Commit

Permalink
perf: turn off shit in the console
Browse files Browse the repository at this point in the history
fix #33
  • Loading branch information
wibus-wee committed Jul 6, 2023
1 parent 36760c2 commit fad8563
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
-`dev``true` 时,全部功能都会启动,你无法通过 `manual` 或其他办法来关闭功能(除了删代码 🙂)。
- 修改了 `config.js` 后,你需要重启 / 重载 Icalingua++ 才能使配置生效。
- 你如果“不小心”填错了功能的 Key,你大可以放心这个功能是不会被启动的,并且在控制台会有错误警告。
- 如果你对这种**控制台乱拉屎**的行为非常厌恶 🤬,你可以将 `log` 设置为 `false` 来关闭控制台输出。

## Preview

Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ window.theme = {
"theme-listener",
],
manual: true,
log: true,
}
2 changes: 2 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function getRoomsPanelWidth() {
}

export function createConsole(code: string, desc: string) {
if (!window.theme.log) return;
console.log(
`%c ${code} %c ${desc}`,
"background: #eaeffd;color:#335eea;padding: 4px 6px;border-radius:3px;",
Expand All @@ -65,6 +66,7 @@ export function createConsoleGroup(
type: "log" | "error" | "warn" | "info";
}[]
) {
if (!window.theme.log) return;
console.groupCollapsed(
`%c ${code} %c ${desc}`,
"background: #eaeffd;color:#335eea;padding: 4px 6px;border-radius:3px;",
Expand Down
1 change: 1 addition & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ declare global {
chatbox: FunctionsKey[],
core: CoresKey[],
manual: boolean, // 是否手动控制功能启动
log: boolean, // 是否打印日志
}
}
}
Expand Down

0 comments on commit fad8563

Please sign in to comment.