♻️ 修改 onPluginEnter 执行时机.

This commit is contained in:
muwoo
2023-10-20 11:23:57 +08:00
parent 7fb299d270
commit 2a1a332fbb
2 changed files with 8 additions and 6 deletions

View File

@@ -175,14 +175,16 @@ export default () => {
const getView = () => view;
const executeHooks = (hook, data) => {
if (!view) return;
const evalJs = `if(window.rubick && window.rubick.hooks && typeof window.rubick.hooks.on${hook} === 'function' ) {
try {
setTimeout(() => {
if (!view) return;
const evalJs = `if(window.rubick && window.rubick.hooks && typeof window.rubick.hooks.on${hook} === 'function' ) {
try {
window.rubick.hooks.on${hook}(${data ? JSON.stringify(data) : ''});
} catch(e) {}
} catch(e) {}
}
`;
view.webContents?.executeJavaScript(evalJs);
view.webContents?.executeJavaScript(evalJs);
}, 300);
};
return {