Create a window using the BrowserWindow module
// In the main process. const BrowserWindow = require('electron').BrowserWindow; // Or in the renderer process. const BrowserWindow = require('electron').remote.BrowserWindow; // Create window function createWindow (){ const win = new BrowserWindow({ width: 800, height: 600, show: false, // Whether to show the window when it is created, default is true backgroundColor: '#363f48', // the background color of the window }); win.loadURL('html/index.html') } createWindow()
Instance methods
win.destroy()
Forces the window to close, unload and beforeunload will not trigger and close will not trigger, but it guarantees that close will trigger.
win.close()
tries to close the window, which has the same effect as if the user had clicked the close button. Although the page may not close, see the close event.
win.focus()
The window gets focus.
win.isFocused()
Returns a boolean, whether the window has the focus.
win.show()
Show and give focus to the window.
win.showInactive()
Show the window but not give it focus.
win.hide()
Hide the window.
win.isVisible()
Returns boolean, whether the window is visible or not.
win.maximize()
Maximize the window.
win.unmaximize()
Unmaximize the window.
Read More:
- Python: How to Create List by Comprehension (Example Codes)
- torch.max Example (How to Use)
- How to Use Printf in HAL Library
- Canvas: How to Implement Video Screenshot Function
- Jquery use queue to implement Ajax request queue Simple Example
- Docker: How to build a rabbitmq image cluster
- Android: How to get the size of font you set (Example Code)
- Android: How to Add Background Music for Activity with Service
- Windows Core Audio APIs: How to Progress Loopback Recording and Generate WAV File
- File class details (get the file name, size, path, create, etc.)
- C#: How to Get details of the directory where the currently running program is located
- Websocket Front-end Call Example
- Opentelemetry + Jaeger Python Version Cross Service Call Example
- Flutter & Dart Enumeration Example
- Hutool Excel Import & Export Example
- Matplotlib Draw 3D scatter Diagram Example
- MySQL Batch Add Data and Store Example
- MultipartFile Upload an Image Example
- go sync.Mutex Lock Examples
- Open CASCADE Technology 7.7.0 released