![]() Let’s apply a little change by altering the menu inside the electron/index.js: const menuTemplateDev = [ This file defines the window, the menu and can contain more code specific to Electron. ![]() This folder contains a index.js, which is the entry point for the Electron app. To emit events from our Electron main process we can apply some changes inside the electron folder that Capacitor created for us. We can use the 2 functions of our app already inside Ionic serve, but the other function only works when the message is received by the renderer. In order to prepare our app we also need to open the app/ and add the package we installed in the beginning: import These are the commands you need to run whenever you want to create an updated Electron build: ionic build & npx cap copy Now you can run a build again and copy all contents to your electron platform and launch the app again. Right now you might see an error - and to fix this quickly open the src/index.html and simply add a dot before the slash in this line (there is usually only a slash): Needed to run once before adding Capacitor platforms If your template is not yet using Angular 9 Go ahead and run the following commands: ionic start devdacticElectron blank -type=angular -capacitor ![]() It’s also recommended to update to the latest Angular version in case you are not yet on Angular 9.īefore you can add the Electron platform with Capacitor you also have to run an initial build, but then you can simply add the platform and open the Electron app. These packages will later help us to communicate with our Electron app from Angular and to package our final app. So first of all we create a blank Ionic application with Capacitor support, then we need to install a few packages. We start with the most basic app and integrate all features one by one. We will build a simple Ionic app with Capacitor and add Electron to finally build a native desktop out of our basic application. If you want to build your Ionic app for multiple platforms you can not only build it for iOS, Android and a web app - you can also use the same code for building a desktop application!Īll of this can be achieved with Electron, which can simply wrap your web application inside a native container that can be used as a real native desktop application on Windows and Mac OS! ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |