focus & blur callback are added

This commit is contained in:
richard-loafle 2020-03-18 17:15:22 +09:00
parent 38eb6f7939
commit 705e74a27b
2 changed files with 10 additions and 1 deletions

View File

@ -27,7 +27,8 @@ export enum ElectronBrowserWindowChannel {
Close = 'close',
Closed = 'closed',
ReadyToShow = 'ready-to-show',
Focus = 'focus'
Focus = 'focus',
Blur = 'blur'
}
export enum ElectronWebContentsChannel {

View File

@ -84,6 +84,14 @@ export class AppWindow {
event.returnValue = true;
});
this.window.on(ElectronBrowserWindowChannel.Focus, () => {
console.log('window got focus');
});
this.window.on(ElectronBrowserWindowChannel.Blur, () => {
console.log('window blur');
});
// on macOS, when the user closes the window we really just hide it. This
// lets us activate quickly and keep all our interesting logic in the
// renderer.