check if electron is ready before creating window (#552)

Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
Neil 2023-05-04 15:59:14 +08:00 committed by GitHub
parent c5decfa98d
commit 57bae77eea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -149,10 +149,14 @@ if (process.defaultApp) {
app.setAsDefaultProtocolClient("tea");
}
app.once("ready", createMainWindow);
let ready = false;
app.once("ready", () => {
ready = true;
createMainWindow();
});
app.on("activate", () => {
if (!mainWindow) {
if (ready && !mainWindow) {
createMainWindow();
}
});