free
web stats

Electron Js – How to Use BrowserWindow

Hi everyone. In last post we have created new eletron project and run. If you look at this tutorial click here;

http://nbasercode.com/electron-js/electron-js-tutorials-installing-and-first-application/

In this post, I’m going to show you what is BrowserWindow module and how we are making use of it to show index.html.

We can pass along with BrowserWindow to customize its look and apperance.

Firstly here is BrowserWindow documentation.

https://github.com/electron/electron/blob/master/docs/api/browser-window.md

It has very rich documentation on Github.

We can pass parameters inside BrowserWindow. For example we can pass height, width, x, y, minWidth, minHeight and etc…

When we can run our project, we can resize project window. If I pass resizeable: false inside BrowserWindow, Project don’t resize.

fullscreen; we can set our project screen with fullscreen;

title; we can change project’s title with pass title parameter.

icon; we can change project’s icon with our icon file.

frame; if we don’t want to use project’s frame, just set this propery false;

Trick: You can look source code with press ctrl + shift + I or go to View –> Toggle Developer Tools.

You can check the documentation for more examples.

Here is all code;

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *