So let’s install os-utils to our project npm install os-utils (The cool thing about electron is you can use any node.js modules or JavaScript libraries for your app) Since we’re going to create an app to monitor the CPU usage, we’ll need to use Node.js module call os-utils. Now we’re ready, it’s time to start coding. I just don’t want to rewrite these code every time when starting a new project. This is why I used Electron Forge to create a new project instead of creating a new one from scratch. Then load the html file into that window, etc. There is a function to create a new window for the app. The JavaScript file here is the main logic of the app. I’m going to use VSCode to open the folder. These files are generated by the electron forge. Now the code for this app is in the src folder. This means you can use HTML, CSS and JavaScript to code this app like you do on a website. Tt looks similar to google chrome since Electron is based on Chromium. A simple text with developer console opened. You should see Hello world app like this. The project comes with skeleton code and necessary script and ready to run. create-electron-app cool-appĮlectron Forge will create a project folder for you Application Logic We’ll install Electron Forge using npm npm install create-electron-app -gĪfter the install has finished, you can create a new project by typing create-electron-app follow by a project name. To create a new project, you can create it from scratch if you want to, but since I’m a lazy person so there is a tool call Electron Forge which will help you setup a project very quickly with some skeleton code to start from.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |