异步代码优化#651
Merged
CodFrm merged 11 commits intoscriptscat:mainfrom Aug 24, 2025
Merged
Conversation
Collaborator
Author
|
先這樣。 |
Merged
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request optimizes asynchronous code by converting async/await patterns to promise chains throughout the codebase. The main purpose is to improve async handling patterns and reduce code complexity.
Key changes:
- Refactored async/await patterns to promise chains for better flow control
- Updated configuration loading to use promise chains instead of async functions
- Simplified backup export logic by returning promise arrays directly
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/pkg/config/config.ts |
Added async value support with promise-based configuration loading |
src/pkg/backup/export.ts |
Converted async methods to return promise arrays for parallel execution |
src/pages/options/routes/Setting.tsx |
Changed async config loading to promise chain pattern |
src/pages/components/CodeEditor/index.tsx |
Simplified config loading using promise chains |
src/locales/locales.ts |
Converted matchLanguage from async function to promise-returning function |
src/app/service/service_worker/utils.ts |
Removed unused utility functions |
src/app/service/service_worker/synchronize.ts |
Optimized resource import operations using promise arrays |
src/app/service/service_worker/script.ts |
Refactored script resource building to use promise chains |
src/app/service/service_worker/runtime.ts |
Converted nested async operations to flatMap promise patterns |
src/app/service/service_worker/fetch.ts |
Simplified icon fetching using promise chains |
src/app/service/offscreen/gm_api.ts |
Fixed FormData file handling with proper promise chains |
src/app/service/content/gm_api.ts |
Optimized FormData processing using promise arrays |
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.