修复浏览器restart未成功#231
Hidden character warning
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a6727d18a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| game.restart(); | ||
| globalEvent.emit(globalEvent.key.restartFinish); |
There was a problem hiding this comment.
Await restart before emitting completion event
game.restart() is asynchronous (Promise<void> in tool/typedoc/declare/cc.d.ts), but restartFinish is emitted immediately afterward, so listeners can run before restart has actually completed. In the browser path, MKBundle uses this event to call initFunc(director.getScene()!); firing early can reinitialize against stale runtime state (or a not-yet-ready scene), which breaks the intended “restart finished” contract.
Useful? React with 👍 / 👎.
No description provided.