electron hide devtools 1

electron hide devtools

mainWindow = new BrowserWindow({ 
     width: 1024,
     height: 768,
     webPreferences: {
      devTools: false /*Disables Devtools*/
      }
   });

Here is what the above code is Doing:
1. We’re creating a new BrowserWindow object.
2. We’re setting the width and height of the window.
3. We’re setting the webPreferences property to an object with a devTools property set to false.

Now, when you run your app, you won’t be able to open DevTools.

*/

/*

The BrowserWindow object has a lot of other properties you can set. Here are a few of them:

1. frame: Whether the window has a frame or not.
2. fullscreen: Whether the window is fullscreen or not.
3. kiosk: Whether the window is in kiosk mode or not.
4. title: The title of the window.
5. icon: The icon of the window.
6. show: Whether the window should be shown when created.
7. webPreferences: A set of web preferences.

*/

/*

The BrowserWindow object also has a lot of methods you can use. Here are a few of them:

1. loadURL: Loads a URL.
2. reload: Reloads the current page.
3. openDevTools: Opens the DevTools.
4. close: Closes the window.
5. focus: Focuses the window.
6. blur: Blurs the window.
7. isFocused: Whether the window is focused.
8. isDestroyed: Whether the window is destroyed.
9. show: Shows the window.
10. showInactive: Shows the window but doesn’t focus it.
11. hide: Hides the window.
12. isVisible: Whether the window is visible.
13. isModal: Whether the window is modal.
14. maximize: Maximizes the window.
15. unmaximize: Unmaximizes the window.
16. isMaximized: Whether the window is maximized.
17. minimize: Minimizes the window.
18. restore: Restores the window.
19. isMinimized: Whether the window is minimized.
20. setFullScreen: Sets whether the window should be in fullscreen mode.
21. isFullScreen: Whether the window is in fullscreen mode.
22. setBounds: Sets the size and position of the window.
23. getBounds: Gets the size and position of the window.
24. setContentBounds: Sets the size and position of the window’s client area.
25. getContentBounds: Gets the size and position of the window’s client area.
26. setSize: Sets the size of the window.
27. getSize: Gets the size of the window.
28. setContentSize: Sets the size of the window’s client area.
29. getContentSize: Gets the size of the window’s client area.
30. setMinimumSize: Sets the minimum size of the window.
31. getMinimumSize: Gets the minimum size of the window.
32. setMaximumSize: Sets the maximum size of the window.
33. getMaximumSize: Gets the maximum size of the window.
34. setResizable: Sets whether the window can be resized.
35. isResizable: Whether the window can be resized.
36. setMovable: Sets whether the window can be moved.
37. isMovable: Whether the window can be moved.
38. setMinimizable: Sets whether the window can be minimized.
39. isMinimizable: Whether the window can be minimized.
40. setMaximizable: Sets whether the window can be maximized.
41. isMaximizable: Whether the window can be maximized.

Similar Posts