✨ 实现异步GM函数#492
Merged
CodFrm merged 1 commit intoscriptscat:mainfrom Jul 5, 2025
Merged
Conversation
CodFrm
reviewed
Jul 5, 2025
| public GMDotSetValue(key: string, value: any): Promise<void> { | ||
| // Asynchronous wrapper for GM_setValue to support GM.setValue | ||
| return new Promise((resolve) => { | ||
| this.GM_setValue(key, value); |
Member
There was a problem hiding this comment.
GM_setValue的实现返回值是一个Promise,这里应该可以直接返回,或者不用专门的实现GMDotSetValue,部分函数同理例如(GM_deleteValue,也可以直接做一个返回)
@GMContext.API({ depend: ["GM_setValue"] })
public GM_deleteValue(name: string): void {
return this.GM_setValue(name, undefined);
}
Member
There was a problem hiding this comment.
思考了一下,毕竟GM_setValue是专门作为同步函数存在的,这样处理一下避免以后又进行了改动,也挺好的
Collaborator
Author
There was a problem hiding this comment.
倒回來 GM_setValue 才是寫錯吧。 按照TM,GM_setValue 不傳回任何東西
還有 GM_setValue的值undefined 不等如刪除 才對
CodFrm
reviewed
Jul 5, 2025
| @GMContext.API({ depend: ["GM_deleteValue"] }) | ||
| public GMDotDeleteValue(name: string): Promise<void> { | ||
| // Asynchronous wrapper for GM_deleteValue to support GM.deleteValue | ||
| return new Promise((resolve) => { |
Member
|
🙏,非常感谢,辛苦了 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.