implement Demo App sections: Dialogs, Menu, Tray, Shell, CrashHang, Notification, Shortcuts etc. Fix some API bugs and implement GlobalShortcut-, Shell- and WebContents-API.

This commit is contained in:
Gregor Biswanger
2017-10-21 04:37:01 +02:00
parent 9046f6ca25
commit 248ddde82b
61 changed files with 2505 additions and 57 deletions

View File

@@ -0,0 +1,32 @@
import { BrowserWindow } from 'electron';
module.exports = (socket: SocketIO.Server) => {
socket.on('register-webContents-crashed', (id) => {
var browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('crashed');
browserWindow.webContents.on('crashed', (event, killed) => {
socket.emit('webContents-crashed' + id, killed);
});
});
socket.on('register-webContents-didFinishLoad', (id) => {
var browserWindow = getWindowById(id);
browserWindow.webContents.removeAllListeners('did-finish-load');
browserWindow.webContents.on('did-finish-load', () => {
socket.emit('webContents-didFinishLoad' + id);
});
});
socket.on('webContentsOpenDevTools', (id, options) => {
if (options) {
getWindowById(id).webContents.openDevTools(options);
} else {
getWindowById(id).webContents.openDevTools();
}
});
function getWindowById(id: number): Electron.BrowserWindow {
return BrowserWindow.fromId(id);
}
};