通过 nodejs 最小化应用程序 ||纯js

Minimizing apps via nodejs || plain js

我目前正在从事个人自动化项目,我想添加 'minimize app' 功能。 例如:当我点击按钮时,我想最小化当前浏览器。我已经有 window.close();但这肯定会关闭应用程序。我发现像 window.minimalize(); 这样的东西或 window.minimize();,但其中 none 对我有用。那么有没有办法最小化应用程序?

已编辑:它不必只是客户端 JS,它可以用作基于终端的 nodejs 应用程序。例如:我键入 minimize Google Chrome,它将最小化它。

一次 Google 搜索 how to minimize browser 给出以下结果:

There is no way to minimize the browser window within javascript. No, there isn't. However, depending on what you're doing and which browsers you're targeting, you could play around with the blur and focus events of the window to achieve similar effect.

或者,如果需要这样的控制,您可以随时将代码移植到 Electron.jsNeutrino.js,它们是为了让您使用 JavaScript 创建桌面应用程序。

也许如果你 post 一些代码并给我们一个思路可以遵循,我们可以解决一些问题。