electron-multi-monitor
Version:
Create multi monitor applications using web development
48 lines (47 loc) • 1.95 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MonitorFactory = void 0;
const path_1 = __importDefault(require("path"));
const MainMonitor_1 = require("./MainMonitor");
class MonitorFactory {
createMain(numberOfOthersToOpen) {
const rank = 0;
const browserWindowOptions = {
// show: false,
x: 0,
y: 0,
width: 1280,
height: 1024,
minWidth: 600,
minHeight: 600,
resizable: true,
movable: true,
titleBarStyle: "default",
backgroundColor: "#FFFFFF",
title: `Multi Monitor #${rank}`,
webPreferences: {
contextIsolation: false,
nodeIntegration: false,
preload: path_1.default.join(__dirname, "../preload/Main.js"),
nativeWindowOpen: true,
affinity: "MULTI-MONITOR",
enableRemoteModule: true //TODO: try to remove this by using IPC calls
}
};
const monitor = new MainMonitor_1.MainMonitor(numberOfOthersToOpen, browserWindowOptions);
return monitor;
}
updateOptions(options) {
if (!options.webPreferences)
throw new Error("webPreferences of the new pop-up window are undefined");
options.webPreferences.preload = path_1.default.join(__dirname, './preload/Other.js');
options.webPreferences.nativeWindowOpen = true;
options.webPreferences.affinity = 'MULTI-MONITOR';
options.webPreferences.nodeIntegration = false;
options.webPreferences.enableRemoteModule = true; //TODO: try to remove this by using IPC calls
}
}
exports.MonitorFactory = MonitorFactory;