mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-26 00:42:19 +00:00
Completed APIs from #956
This commit is contained in:
@@ -125,6 +125,27 @@ module.exports = (socket) => {
|
||||
electronSocket.emit("webContents-foundInPage" + id, result);
|
||||
});
|
||||
});
|
||||
socket.on("register-webContents-audioStateChanged", (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.removeAllListeners("audio-state-changed");
|
||||
browserWindow.webContents.on("audio-state-changed", (event) => {
|
||||
electronSocket.emit("webContents-audioStateChanged" + id, event.audible);
|
||||
});
|
||||
});
|
||||
socket.on("register-webContents-mediaStartedPlaying", (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.removeAllListeners("media-started-playing");
|
||||
browserWindow.webContents.on("media-started-playing", () => {
|
||||
electronSocket.emit("webContents-mediaStartedPlaying" + id);
|
||||
});
|
||||
});
|
||||
socket.on("register-webContents-mediaPaused", (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
browserWindow.webContents.removeAllListeners("media-paused");
|
||||
browserWindow.webContents.on("media-paused", () => {
|
||||
electronSocket.emit("webContents-mediaPaused" + id);
|
||||
});
|
||||
});
|
||||
socket.on("webContents-openDevTools", (id, options) => {
|
||||
if (options) {
|
||||
getWindowById(id).webContents.openDevTools(options);
|
||||
@@ -491,6 +512,12 @@ module.exports = (socket) => {
|
||||
socket.on("webContents-centerSelection", (id) => {
|
||||
getWindowById(id).webContents.centerSelection();
|
||||
});
|
||||
socket.on("webContents-scrollToTop", (id) => {
|
||||
getWindowById(id).webContents.scrollToTop();
|
||||
});
|
||||
socket.on("webContents-scrollToBottom", (id) => {
|
||||
getWindowById(id).webContents.scrollToBottom();
|
||||
});
|
||||
socket.on("webContents-insertText", async (id, text) => {
|
||||
await getWindowById(id).webContents.insertText(text);
|
||||
electronSocket.emit("webContents-insertText-completed" + id);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -121,6 +121,33 @@ export = (socket: Socket) => {
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("register-webContents-audioStateChanged", (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners("audio-state-changed");
|
||||
browserWindow.webContents.on("audio-state-changed", (event) => {
|
||||
electronSocket.emit("webContents-audioStateChanged" + id, event.audible);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("register-webContents-mediaStartedPlaying", (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners("media-started-playing");
|
||||
browserWindow.webContents.on("media-started-playing", () => {
|
||||
electronSocket.emit("webContents-mediaStartedPlaying" + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("register-webContents-mediaPaused", (id) => {
|
||||
const browserWindow = getWindowById(id);
|
||||
|
||||
browserWindow.webContents.removeAllListeners("media-paused");
|
||||
browserWindow.webContents.on("media-paused", () => {
|
||||
electronSocket.emit("webContents-mediaPaused" + id);
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("webContents-openDevTools", (id, options) => {
|
||||
if (options) {
|
||||
getWindowById(id).webContents.openDevTools(options);
|
||||
@@ -682,6 +709,14 @@ export = (socket: Socket) => {
|
||||
getWindowById(id).webContents.centerSelection();
|
||||
});
|
||||
|
||||
socket.on("webContents-scrollToTop", (id) => {
|
||||
getWindowById(id).webContents.scrollToTop();
|
||||
});
|
||||
|
||||
socket.on("webContents-scrollToBottom", (id) => {
|
||||
getWindowById(id).webContents.scrollToBottom();
|
||||
});
|
||||
|
||||
socket.on("webContents-insertText", async (id, text) => {
|
||||
await getWindowById(id).webContents.insertText(text);
|
||||
electronSocket.emit("webContents-insertText-completed" + id);
|
||||
|
||||
Reference in New Issue
Block a user