})
}
+BrowserWindow.prototype.setModal = function (modal) {
+ const parent = this.getParentWindow()
+ if (!parent) {
+ throw new Error('setModal can only be called for child window')
+ }
+
+ let closeListener = () => parent.enable()
+ if (modal) {
+ parent.disable()
+ this.once('closed', closeListener)
+ this.show()
+ } else {
+ parent.enable()
+ this.removeListener('closed', closeListener)
+ }
+}
+
BrowserWindow.getFocusedWindow = () => {
for (let window of BrowserWindow.getAllWindows()) {
if (window.isFocused()) return window
}
// Helpers.
-
Object.assign(BrowserWindow.prototype, {
loadURL (...args) {
return this.webContents.loadURL.apply(this.webContents, args)