fix(gui): fix potencial false window load

This commit is contained in:
Alexey Kasyanchuk 2018-06-18 00:21:35 +03:00
parent d2ad3be4d5
commit 94218b7b74
2 changed files with 610 additions and 605 deletions

View File

@ -152,14 +152,6 @@ app.on("ready", () => {
dbPatcher(() => {
changeLanguage(appConfig.language, () => setApplicationMenu())
mainWindow.loadURL(
url.format({
pathname: path.join(__dirname, "app.html"),
protocol: "file:",
slashes: true
})
);
if (env.name === "development") {
mainWindow.openDevTools();
}
@ -240,6 +232,17 @@ app.on("ready", () => {
callback.apply(null, arg)
})
}, app.getPath("userData"), app.getVersion(), env.name)
// load page only after init app
spider.initialized.then(() => {
mainWindow.loadURL(
url.format({
pathname: path.join(__dirname, "app.html"),
protocol: "file:",
slashes: true
})
);
})
}, mainWindow, sphinx)
}, app.getPath("userData"), () => app.quit())
});

View File

@ -36,6 +36,8 @@ const torrentClient = require('./torrentClient')
module.exports = function (send, recive, dataDirectory, version, env)
{
this.initialized = (async () =>
{
let torrentsId = 1;
let filesId = 1;
@ -721,7 +723,7 @@ setInterval(() => {
// load inside api
// setup api
API({
await API({
sphinx,
recive,
send,
@ -839,6 +841,6 @@ setInterval(() => {
}))
})
}
return this
})()
}