Yellow Friday Pandas
Getting Started
Boilerplate: https://github.com/sindresorhus/electron-boilerplate
- Have WebStorm, Node.JS
- Open WebStorm, and
git clonethis project. - In the root directory of this project, run the node package manager to install any dependencies listed in the
package.json.npm install - Run the program by running the Electron command.
electron .## Technologies Used ### Electron #### Setup - npm: https://www.npmjs.com/
- npm install -g electron --save-dev
Quick Start
- Main Process
- package.json's main --> the main process
- script that runs in main proccess can display GUI via web pages
Renderer Process
- uses chromium
- each web page in Electron runs in its own process (the renderer process)
- use Node.js APIs in web pages to interact with OS
Main vs. Renderer Processes
- Main process creates pages by creating
BrowserWindowinstances- each
BrowserWindowinstance runs web page in its own renderer process - When
BrowserWindowinstance destroyed, renderer process also terminated - main process manages all web pages + corresponding renderer processes
- render processes only care about page its running on
- each
- GUI related APIs in web pages not allowed (leak resources)
- GUI operations on web page performed by renderer process communicating with main process
- renderer process requests main process performs desired action
- Communication between main process and renderer processes
ipcRendererandipcMain(inter-process communication) modules for sending messages- remote module for RPC (?) style communication
- Main process creates pages by creating
Write your First Electron App
- Structure
your-app/
├── package.json
├── main.js
└── index.html
- package.json format exactly same as Node's modules
- if main field is not present in package.json, attempts to load index.js
- script in main field -> startup script of app runs main process
- main.js creates windows and handle system events
- index.js is the web page to be showed
- package.json format exactly same as Node's modules
- keep a global reference of window obj, otherwise window will be closed when js garbage collected
Reference
- https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API
- http://processingjs.org/
- https://github.com/karan
- Search for "brain" or "sound" or something
- http://sonic-pi.net/
- Boilerplate
Log in or sign up for Devpost to join the conversation.