mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
fix window reloading
This commit is contained in:
parent
ba1ddcee0c
commit
d8181e9229
5 changed files with 13 additions and 8 deletions
|
@ -47,8 +47,7 @@ powerMonitor.on('suspend', () => {
|
|||
});
|
||||
|
||||
powerMonitor.on('resume', () => {
|
||||
BrowserWindow.getAllWindows().forEach(win => win.webContents.reload());
|
||||
|
||||
WindowManager.reloadAll();
|
||||
Util.log('info', '[PowerMonitor] resume');
|
||||
});
|
||||
|
||||
|
|
|
@ -210,6 +210,11 @@ class Api {
|
|||
WindowManager.createChallenge(param);
|
||||
};
|
||||
|
||||
reload (win, route) {
|
||||
win.route = route;
|
||||
win.webContents.reload();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
module.exports = new Api();
|
|
@ -236,7 +236,6 @@ class Util {
|
|||
];
|
||||
};
|
||||
|
||||
|
||||
translate (key) {
|
||||
const lang = this.getLang();
|
||||
const defaultData = require(`../../dist/lib/json/lang/en-US.json`);
|
||||
|
|
|
@ -228,13 +228,11 @@ class WindowManager {
|
|||
|
||||
sendToAll () {
|
||||
const args = [ ...arguments ];
|
||||
this.list.forEach(it => {
|
||||
Util.send.apply(this, [ it ].concat(args));
|
||||
});
|
||||
this.list.forEach(it => Util.send.apply(this, [ it ].concat(args)));
|
||||
};
|
||||
|
||||
reloadAll () {
|
||||
this.list.forEach(it => it.webContents.reload());
|
||||
this.sendToAll('reload');
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -278,9 +278,9 @@ class App extends React.Component<object, State> {
|
|||
Renderer.on('leave-full-screen', () => commonStore.fullscreenSet(false));
|
||||
Renderer.on('logout', () => authStore.logout(false, false));
|
||||
Renderer.on('data-path', (e: any, p: string) => commonStore.dataPathSet(p));
|
||||
|
||||
Renderer.on('shutdownStart', () => {
|
||||
this.setState({ loading: true });
|
||||
|
||||
Storage.delete('menuSearchText');
|
||||
});
|
||||
|
||||
|
@ -301,6 +301,10 @@ class App extends React.Component<object, State> {
|
|||
keyboard.setPinChecked(false);
|
||||
UtilRouter.go('/auth/pin-check', { replace: true, animate: true });
|
||||
});
|
||||
|
||||
Renderer.on('reload', () => {
|
||||
Renderer.send('reload', UtilRouter.getRoute());
|
||||
});
|
||||
};
|
||||
|
||||
onInit (e: any, data: any) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue