mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-19 07:06:26 +00:00
Update transformed files
This commit is contained in:
@@ -2,17 +2,22 @@
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.browserViewMediateService = exports.browserViewApi = void 0;
|
||||
const electron_1 = require("electron");
|
||||
const browserViews = (global['browserViews'] = global['browserViews'] || []);
|
||||
let browserView, electronSocket;
|
||||
const proxyToCredentialsMap = (global['proxyToCredentialsMap'] = global['proxyToCredentialsMap'] || []);
|
||||
const browserViews = (global["browserViews"] =
|
||||
global["browserViews"] || []);
|
||||
const proxyToCredentialsMap = (global["proxyToCredentialsMap"] = global["proxyToCredentialsMap"] || []);
|
||||
let browserView;
|
||||
let electronSocket;
|
||||
const browserViewApi = (socket) => {
|
||||
electronSocket = socket;
|
||||
socket.on('createBrowserView', (options) => {
|
||||
if (!hasOwnChildreen(options, 'webPreferences', 'nodeIntegration')) {
|
||||
options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } };
|
||||
socket.on("createBrowserView", (options) => {
|
||||
if (!hasOwnChildreen(options, "webPreferences", "nodeIntegration")) {
|
||||
options = {
|
||||
...options,
|
||||
webPreferences: { nodeIntegration: true, contextIsolation: false },
|
||||
};
|
||||
}
|
||||
browserView = new electron_1.BrowserView(options);
|
||||
browserView['id'] = browserViews.length + 1;
|
||||
browserView["id"] = browserViews.length + 1;
|
||||
if (options.proxy) {
|
||||
browserView.webContents.session.setProxy({ proxyRules: options.proxy });
|
||||
}
|
||||
@@ -20,19 +25,19 @@ const browserViewApi = (socket) => {
|
||||
proxyToCredentialsMap[options.proxy] = options.proxyCredentials;
|
||||
}
|
||||
browserViews.push(browserView);
|
||||
electronSocket.emit('BrowserViewCreated', browserView['id']);
|
||||
electronSocket.emit("BrowserViewCreated", browserView["id"]);
|
||||
});
|
||||
socket.on('browserView-bounds', (id) => {
|
||||
socket.on("browserView-bounds", (id) => {
|
||||
const bounds = getBrowserViewById(id).getBounds();
|
||||
electronSocket.emit('browserView-bounds-completed', bounds);
|
||||
electronSocket.emit("browserView-bounds-completed", bounds);
|
||||
});
|
||||
socket.on('browserView-bounds-set', (id, bounds) => {
|
||||
socket.on("browserView-bounds-set", (id, bounds) => {
|
||||
getBrowserViewById(id).setBounds(bounds);
|
||||
});
|
||||
socket.on('browserView-setAutoResize', (id, options) => {
|
||||
socket.on("browserView-setAutoResize", (id, options) => {
|
||||
getBrowserViewById(id).setAutoResize(options);
|
||||
});
|
||||
socket.on('browserView-setBackgroundColor', (id, color) => {
|
||||
socket.on("browserView-setBackgroundColor", (id, color) => {
|
||||
getBrowserViewById(id).setBackgroundColor(color);
|
||||
});
|
||||
function hasOwnChildreen(obj, ...childNames) {
|
||||
@@ -53,7 +58,7 @@ exports.browserViewMediateService = browserViewMediateService;
|
||||
function getBrowserViewById(id) {
|
||||
for (let index = 0; index < browserViews.length; index++) {
|
||||
const browserViewItem = browserViews[index];
|
||||
if (browserViewItem['id'] === id) {
|
||||
if (browserViewItem["id"] === id) {
|
||||
return browserViewItem;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user