mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-22 06:19:50 +01:00
removed mentions of electron.remote (still one left)
This commit is contained in:
parent
5f58118537
commit
7bfcab4610
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
node_modules/
|
||||
game
|
||||
out/
|
||||
.vscode/
|
@ -1,5 +1,4 @@
|
||||
const { remote } = require('electron')
|
||||
const {Menu, BrowserWindow, MenuItem, shell} = remote
|
||||
|
||||
function getCurrentWindow() {
|
||||
return remote.getCurrentWindow()
|
||||
@ -7,36 +6,16 @@ function getCurrentWindow() {
|
||||
|
||||
function minimizeWindow(browserWindow = getCurrentWindow()) {
|
||||
if (browserWindow.minimizable) {
|
||||
// browserWindow.isMinimizable() for old electron versions
|
||||
browserWindow.minimize()
|
||||
}
|
||||
}
|
||||
|
||||
function unmaximizeWindow(browserWindow = getCurrentWindow()) {
|
||||
browserWindow.unmaximize()
|
||||
}
|
||||
|
||||
function maxUnmaxWindow(browserWindow = getCurrentWindow()) {
|
||||
if (browserWindow.isMaximized()) {
|
||||
browserWindow.unmaximize()
|
||||
} else {
|
||||
browserWindow.maximize()
|
||||
}
|
||||
}
|
||||
|
||||
function closeWindow(browserWindow = getCurrentWindow()) {
|
||||
browserWindow.close()
|
||||
}
|
||||
|
||||
function isWindowMaximized(browserWindow = getCurrentWindow()) {
|
||||
return browserWindow.isMaximized()
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getCurrentWindow,
|
||||
minimizeWindow,
|
||||
unmaximizeWindow,
|
||||
maxUnmaxWindow,
|
||||
isWindowMaximized,
|
||||
closeWindow,
|
||||
}
|
@ -1,23 +1,16 @@
|
||||
'use strict';
|
||||
const {remote, ipcRenderer} = require('electron');
|
||||
const {ipcRenderer} = require('electron');
|
||||
const {
|
||||
getCurrentWindow,
|
||||
minimizeWindow,
|
||||
unmaximizeWindow,
|
||||
maxUnmaxWindow,
|
||||
isWindowMaximized,
|
||||
closeWindow,
|
||||
} = require("./assets/js/menubar.js");
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
window.getCurrentWindow = getCurrentWindow
|
||||
window.minimizeWindow = minimizeWindow
|
||||
window.unmaximizeWindow = unmaximizeWindow
|
||||
window.maxUnmaxWindow = maxUnmaxWindow
|
||||
window.isWindowMaximized = isWindowMaximized
|
||||
window.closeWindow = closeWindow
|
||||
const minimizeButton = document.getElementById("minimize-btn")
|
||||
const maxUnmaxButton = document.getElementById("max-unmax-btn")
|
||||
const closeButton = document.getElementById("close-btn")
|
||||
|
||||
minimizeButton.addEventListener("click", e => window.minimizeWindow())
|
||||
|
Loading…
Reference in New Issue
Block a user