UNPKG

electron-multi-monitor

Version:

Create multi monitor applications using web development

29 lines (28 loc) 964 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ElectronMultiMonitor = void 0; const OtherMonitor_1 = require("./OtherMonitor"); class ElectronMultiMonitor { constructor(mainWindow, numberOfMonitors) { this.mainWindow = mainWindow; this.numberOfMonitors = numberOfMonitors; this.otherMonitors = []; if (numberOfMonitors === 1) this.triggerOnReady(); } registerOtherMonitor(window) { const otherMonitor = new OtherMonitor_1.OtherMonitor(window); this.otherMonitors.push(otherMonitor); if (this.otherMonitors.length === this.numberOfMonitors) { this.triggerOnReady(); } return this.mainWindow; } triggerOnReady() { setTimeout(() => { if (this.onReady) this.onReady(this); }, 10); } } exports.ElectronMultiMonitor = ElectronMultiMonitor;