From ffa107d06ad83375601be649f07226665eb74ad5 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Tue, 2 Mar 2021 15:22:38 +0100 Subject: [PATCH] removed mentions of electron.remote (still one left) --- .gitignore | 1 + src/client/assets/js/menubar.js | 21 --------------------- src/client/assets/js/script.js | 9 +-------- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index de34272..8f0515e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ game out/ +.vscode/ \ No newline at end of file diff --git a/src/client/assets/js/menubar.js b/src/client/assets/js/menubar.js index d35a9d2..fb580ba 100644 --- a/src/client/assets/js/menubar.js +++ b/src/client/assets/js/menubar.js @@ -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, } \ No newline at end of file diff --git a/src/client/assets/js/script.js b/src/client/assets/js/script.js index e2b5722..6e5a209 100644 --- a/src/client/assets/js/script.js +++ b/src/client/assets/js/script.js @@ -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())