mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-21 22:45:20 +00:00
ElectronNET.Host: Fix TS compilation error webcontents.ts
The crashed event has been removed in Electron 29 - just let TS ignore that error
This commit is contained in:
@@ -6,10 +6,13 @@ let electronSocket;
|
||||
|
||||
export = (socket: Socket) => {
|
||||
electronSocket = socket;
|
||||
|
||||
// The crashed event has been removed in Electron 29
|
||||
socket.on('register-webContents-crashed', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners('crashed');
|
||||
// @ts-expect-error No overload matches this call
|
||||
browserWindow.webContents.on('crashed', (event, killed) => {
|
||||
electronSocket.emit('webContents-crashed' + id, killed);
|
||||
});
|
||||
@@ -246,6 +249,19 @@ export = (socket: Socket) => {
|
||||
browserWindow.webContents.session.setUserAgent(userAgent, acceptLanguages);
|
||||
});
|
||||
|
||||
socket.on('register-webContents-session-webRequest-onBeforeRequest', (id, filter) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
const session = browserWindow.webContents.session;
|
||||
|
||||
session.webRequest.onBeforeRequest(filter, (details, callback) => {
|
||||
socket.emit(`webContents-session-webRequest-onBeforeRequest${id}`, details);
|
||||
// Listen for a response from C# to continue the request
|
||||
electronSocket.once(`webContents-session-webRequest-onBeforeRequest-response${id}`, (response) => {
|
||||
callback(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
socket.on('register-webContents-session-cookies-changed', (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user