refactor: 'focus-change' does not need guestInstanceId (#29001)
* refactor: 'focus-change' does not need guestInstanceId * refactor: rename internal 'focus-change' event to '-focus-change'
This commit is contained in:
parent
476e908269
commit
2086e1903c
4 changed files with 12 additions and 23 deletions
|
@ -3,16 +3,16 @@ import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages';
|
|||
|
||||
const v8Util = process._linkedBinding('electron_common_v8_util');
|
||||
|
||||
function handleFocusBlur (guestInstanceId: number) {
|
||||
function handleFocusBlur () {
|
||||
// Note that while Chromium content APIs have observer for focus/blur, they
|
||||
// unfortunately do not work for webview.
|
||||
|
||||
window.addEventListener('focus', () => {
|
||||
ipcRendererInternal.send(IPC_MESSAGES.GUEST_VIEW_MANAGER_FOCUS_CHANGE, true, guestInstanceId);
|
||||
ipcRendererInternal.send(IPC_MESSAGES.GUEST_VIEW_MANAGER_FOCUS_CHANGE, true);
|
||||
});
|
||||
|
||||
window.addEventListener('blur', () => {
|
||||
ipcRendererInternal.send(IPC_MESSAGES.GUEST_VIEW_MANAGER_FOCUS_CHANGE, false, guestInstanceId);
|
||||
ipcRendererInternal.send(IPC_MESSAGES.GUEST_VIEW_MANAGER_FOCUS_CHANGE, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,6 @@ export function webViewInit (
|
|||
|
||||
if (guestInstanceId) {
|
||||
// Report focus/blur events of webview to browser.
|
||||
handleFocusBlur(guestInstanceId);
|
||||
handleFocusBlur();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue