1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

Merge pull request #583 from anytypeio/refactoring/521

Refactoring
This commit is contained in:
Razor 2020-07-24 17:51:10 +03:00 committed by GitHub
commit 235a8c1109
11 changed files with 134 additions and 174 deletions

View file

@ -19,6 +19,7 @@ let userPath = app.getPath('userData');
let waitLibraryPromise;
let useGRPC = !process.env.ANYTYPE_USE_ADDON && (process.env.ANYTYPE_USE_GRPC || (process.platform == "win32") || is.development);
let defaultChannel = version.match('alpha') ? 'alpha' : 'latest';
let timeoutUpdate = 0;
let service, server;
@ -400,8 +401,10 @@ function configSet (obj, callBack) {
function checkUpdate () {
if (!isUpdating) {
Util.log('info', 'checkForUpdatesAndNotify');
Util.log('info', 'checkUpdate');
autoUpdater.checkForUpdatesAndNotify();
clearTimeout(timeoutUpdate);
timeoutUpdate = setTimeout(checkUpdate, 600 * 1000);
};
};
@ -413,7 +416,6 @@ function autoUpdaterInit () {
autoUpdater.channel = config.channel;
checkUpdate();
setInterval(checkUpdate, 600 * 1000);
autoUpdater.on('checking-for-update', () => {
Util.log('info', 'Checking for update');
@ -422,6 +424,7 @@ function autoUpdaterInit () {
autoUpdater.on('update-available', (info) => {
Util.log('info', 'Update available');
isUpdating = true;
clearTimeout(timeoutUpdate);
win.webContents.send('update');
});