Skip to content

Commit

Permalink
fix: 🐛 修复 dom-ready 执行的顺序
Browse files Browse the repository at this point in the history
  • Loading branch information
caorushizi committed May 13, 2024
1 parent 9b421e3 commit 7cb2cd2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/main/src/services/WebviewService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ export default class WebviewService {
this.setUserAgent(isMobile);

this.webContents.on("dom-ready", async () => {
const baseInfo = {
title: this.webContents.getTitle(),
url: this.webContents.getURL(),
};
this.sniffingHelper.reset(baseInfo);
this.curWindow?.webContents.send("webview-dom-ready", baseInfo);

try {
if (isDev && process.env.DEBUG_PLUGINS === "true") {
const content =
Expand All @@ -63,13 +70,6 @@ export default class WebviewService {
} catch (err) {
// empty
}

const baseInfo = {
title: this.webContents.getTitle(),
url: this.webContents.getURL(),
};
this.sniffingHelper.reset(baseInfo);
this.curWindow?.webContents.send("webview-dom-ready", baseInfo);
});

// 兼容网站在当前页面中打开
Expand Down

0 comments on commit 7cb2cd2

Please sign in to comment.