我正在开发一个应用程序(带电子),我希望用户能够在按下"esc"时退出全屏模式.我尝试了不同的方法,徒劳无功.以下是以全屏模式在新浏览器窗口中启动应用程序以及显示和HTML/CSS内容的代码:
'use strict';
const electron = require('electron');
// Module to control application life.
const app = electron.app;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow;
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({fullscreen:true});
// and load the index.html of the app.
mainWindow.loadURL('file://' + __dirname …Run Code Online (Sandbox Code Playgroud)