Learning Electron.js
January 12, 2020 ยท View on GitHub
Just one of the things I'm learning. https://github.com/hchiam/learning
Electron lets you build native desktop apps with web technologies (JS, HTML, CSS, Node.js, etc).
Main code flow: main.js -> index.html -> renderer.js
Minimum files
package.json- Points to app's main file and lists details and dependencies.main.js- Starts app and creates browser window to render HTML. The app's main process.index.html- Web page to render. The app's renderer process.
Main simple example
npm install
npm start
Or if you prefer yarn instead:
yarn
yarn start
Other simple examples to learn from
Prices example (API calls) in the prices-example folder.
https://github.com/hchiam/electron-test
Quick start from the electron-quick-start template
git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install
npm start
My example that uses Travis CI automated testing
https://github.com/hchiam/anonymous-input
General links to learn from
https://github.com/electron/electron-quick-start
https://electronjs.org/docs/tutorial/first-app
https://github.com/electron/electron-api-demos
https://github.com/electron/simple-samples
https://electronjs.org/community#boilerplates
Boilerplates
Electron with React
- src/
electron-starter.js:mainWindow,createWindow, andapp.onevent listeners - src/
index.js->AppfromApp.js->render()
https://github.com/electron-react-boilerplate/electron-react-boilerplate
- app/
main.dev.js:mainWindow,createWindow, andapp.onevent listeners - app/
index.js->Rootfrom app/containers/Root.js->Routesfrom app/Routes.js-> containers/HomePage.js, containers/CounterPage.js, app/containers/App.js-> app/components/Home.js, app/components/Counter.js, app/actions/counter.js
Electron with Vue
https://github.com/SimulatedGREG/electron-vue