Skip to content

Conversation

@cyfung1031
Copy link
Collaborator

概述 Descriptions

关联的 commit 3e406dc

变更内容 Changes

截图 Screenshots

@cyfung1031 cyfung1031 changed the base branch from main to release/v1.3 November 4, 2025 08:36
@CodFrm CodFrm requested a review from Copilot November 4, 2025 08:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

这个 PR 重构了 updateIcon 方法,使其能够根据 isUserScriptsAvailableisLoadScripts 两个状态自动判断应该显示哪个图标,而不再需要调用方传入参数。

主要变更:

  • updateIcon 方法从接受 enableUserscript 参数改为无参数,内部自动计算状态
  • 简化了方法实现,消除了重复的 chrome.action.setIcon 调用
  • 在适当的时机添加了 updateIcon() 调用,确保图标状态正确更新

console.error("chrome.runtime.lastError in chrome.action.setIcon:", lastError);
}
updateIcon() {
const enableUserscript: boolean = this.isUserScriptsAvailable && this.isLoadScripts;
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] 变量 enableUserscript 使用了不必要的显式类型注解。TypeScript 可以从右侧的布尔表达式自动推断类型为 boolean。建议移除 : boolean 以保持代码简洁,符合 TypeScript 最佳实践。

Suggested change
const enableUserscript: boolean = this.isUserScriptsAvailable && this.isLoadScripts;
const enableUserscript = this.isUserScriptsAvailable && this.isLoadScripts;

Copilot uses AI. Check for mistakes.
@CodFrm CodFrm merged commit 642e3b9 into scriptscat:release/v1.3 Nov 4, 2025
9 checks passed
@cyfung1031 cyfung1031 deleted the pr-icon-coding-3004 branch December 21, 2025 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants