mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
wrap window state in try catch
This commit is contained in:
parent
d7cfcdf648
commit
20e3a8d5c2
1 changed files with 17 additions and 8 deletions
|
@ -113,15 +113,11 @@ class WindowManager {
|
|||
});
|
||||
} catch (e) {};
|
||||
} else {
|
||||
const { screen } = require('electron');
|
||||
const primaryDisplay = screen.getPrimaryDisplay();
|
||||
const { width, height } = primaryDisplay.workAreaSize;
|
||||
const { width, height } = this.getScreenSize();
|
||||
|
||||
param = Object.assign(param, this.getWindowPosition(param, width, height));
|
||||
};
|
||||
|
||||
console.log('PARAM', param);
|
||||
|
||||
const win = this.create(options, param);
|
||||
|
||||
if (!isChild) {
|
||||
|
@ -142,9 +138,7 @@ class WindowManager {
|
|||
};
|
||||
|
||||
createChallenge (options) {
|
||||
const { screen } = require('electron');
|
||||
const primaryDisplay = screen.getPrimaryDisplay();
|
||||
const { width, height } = primaryDisplay.workAreaSize;
|
||||
const { width, height } = this.getScreenSize();
|
||||
|
||||
const win = this.create({ ...options, isChallenge: true }, {
|
||||
backgroundColor: '',
|
||||
|
@ -171,6 +165,21 @@ class WindowManager {
|
|||
return win;
|
||||
};
|
||||
|
||||
getScreenSize () {
|
||||
const ret = { width: DEFAULT_WIDTH, height: DEFAULT_HEIGHT };
|
||||
|
||||
try {
|
||||
const { screen } = require('electron');
|
||||
const primaryDisplay = screen.getPrimaryDisplay();
|
||||
const { width, height } = primaryDisplay.workAreaSize;
|
||||
|
||||
ret.width = width;
|
||||
ret.height = height;
|
||||
} catch (e) {};
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
closeChallenge (options) {
|
||||
for (const win of this.list) {
|
||||
if (win && win.isChallenge && (win.challenge == options.challenge) && !win.isDestroyed()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue