4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-25 06:49:51 +01:00

removed mentions of electron.remote (still one left)

This commit is contained in:
Quentin Legot 2021-03-02 15:22:38 +01:00
parent f5eda33103
commit ffa107d06a
3 changed files with 2 additions and 29 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules/
game
out/
.vscode/

View File

@ -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,
}

View File

@ -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())