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:
parent
f5eda33103
commit
ffa107d06a
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
game
|
game
|
||||||
out/
|
out/
|
||||||
|
.vscode/
|
@ -1,5 +1,4 @@
|
|||||||
const { remote } = require('electron')
|
const { remote } = require('electron')
|
||||||
const {Menu, BrowserWindow, MenuItem, shell} = remote
|
|
||||||
|
|
||||||
function getCurrentWindow() {
|
function getCurrentWindow() {
|
||||||
return remote.getCurrentWindow()
|
return remote.getCurrentWindow()
|
||||||
@ -7,36 +6,16 @@ function getCurrentWindow() {
|
|||||||
|
|
||||||
function minimizeWindow(browserWindow = getCurrentWindow()) {
|
function minimizeWindow(browserWindow = getCurrentWindow()) {
|
||||||
if (browserWindow.minimizable) {
|
if (browserWindow.minimizable) {
|
||||||
// browserWindow.isMinimizable() for old electron versions
|
|
||||||
browserWindow.minimize()
|
browserWindow.minimize()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function unmaximizeWindow(browserWindow = getCurrentWindow()) {
|
|
||||||
browserWindow.unmaximize()
|
|
||||||
}
|
|
||||||
|
|
||||||
function maxUnmaxWindow(browserWindow = getCurrentWindow()) {
|
|
||||||
if (browserWindow.isMaximized()) {
|
|
||||||
browserWindow.unmaximize()
|
|
||||||
} else {
|
|
||||||
browserWindow.maximize()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeWindow(browserWindow = getCurrentWindow()) {
|
function closeWindow(browserWindow = getCurrentWindow()) {
|
||||||
browserWindow.close()
|
browserWindow.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
function isWindowMaximized(browserWindow = getCurrentWindow()) {
|
|
||||||
return browserWindow.isMaximized()
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getCurrentWindow,
|
getCurrentWindow,
|
||||||
minimizeWindow,
|
minimizeWindow,
|
||||||
unmaximizeWindow,
|
|
||||||
maxUnmaxWindow,
|
|
||||||
isWindowMaximized,
|
|
||||||
closeWindow,
|
closeWindow,
|
||||||
}
|
}
|
@ -1,23 +1,16 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const {remote, ipcRenderer} = require('electron');
|
const {ipcRenderer} = require('electron');
|
||||||
const {
|
const {
|
||||||
getCurrentWindow,
|
getCurrentWindow,
|
||||||
minimizeWindow,
|
minimizeWindow,
|
||||||
unmaximizeWindow,
|
|
||||||
maxUnmaxWindow,
|
|
||||||
isWindowMaximized,
|
|
||||||
closeWindow,
|
closeWindow,
|
||||||
} = require("./assets/js/menubar.js");
|
} = require("./assets/js/menubar.js");
|
||||||
|
|
||||||
window.addEventListener("DOMContentLoaded", () => {
|
window.addEventListener("DOMContentLoaded", () => {
|
||||||
window.getCurrentWindow = getCurrentWindow
|
window.getCurrentWindow = getCurrentWindow
|
||||||
window.minimizeWindow = minimizeWindow
|
window.minimizeWindow = minimizeWindow
|
||||||
window.unmaximizeWindow = unmaximizeWindow
|
|
||||||
window.maxUnmaxWindow = maxUnmaxWindow
|
|
||||||
window.isWindowMaximized = isWindowMaximized
|
|
||||||
window.closeWindow = closeWindow
|
window.closeWindow = closeWindow
|
||||||
const minimizeButton = document.getElementById("minimize-btn")
|
const minimizeButton = document.getElementById("minimize-btn")
|
||||||
const maxUnmaxButton = document.getElementById("max-unmax-btn")
|
|
||||||
const closeButton = document.getElementById("close-btn")
|
const closeButton = document.getElementById("close-btn")
|
||||||
|
|
||||||
minimizeButton.addEventListener("click", e => window.minimizeWindow())
|
minimizeButton.addEventListener("click", e => window.minimizeWindow())
|
||||||
|
Loading…
Reference in New Issue
Block a user