├── README.md ├── examples ├── readme.md ├── electron-batch-childprocess │ ├── package.json │ ├── main.js │ └── index.html ├── electron-webcamera │ ├── package.json │ ├── main.js │ └── index.html ├── electron-folderandfilewatcher │ ├── package.json │ ├── main.js │ └── index.html └── electron-voicecommands-speechsynthesis │ ├── package.json │ ├── main.js │ └── index.html └── LICENSE /README.md: -------------------------------------------------------------------------------- 1 | # electron-examples 2 | A collection of electron example about everything that you can do with electron <3 ! 3 | -------------------------------------------------------------------------------- /examples/readme.md: -------------------------------------------------------------------------------- 1 | # Remember to install the dependencies before using them, otherwise will not work obviously ... 2 | 3 | Or install and start every example using : 4 | 5 | ```bash 6 | npm install && npm start 7 | ``` 8 | -------------------------------------------------------------------------------- /examples/electron-batch-childprocess/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ourcodeworldelectron", 3 | "version": "1.0.0", 4 | "description": "A quick description of your project", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "electron main.js" 8 | }, 9 | "author": "Our Code World", 10 | "license": "CC0-1.0", 11 | "devDependencies": { 12 | "electron-prebuilt": "^1.0.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/electron-webcamera/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ourcodeworldelectron-webcamera", 3 | "version": "1.0.0", 4 | "description": "Example webcamera with electron", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "electron main.js" 8 | }, 9 | "author": "Our Code World", 10 | "license": "CC0-1.0", 11 | "devDependencies": { 12 | "electron-prebuilt": "^0.37.2" 13 | }, 14 | "dependencies": { 15 | "webcamjs": "^1.0.6" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/electron-folderandfilewatcher/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ourcodeworldelectron", 3 | "version": "1.0.0", 4 | "description": "A quick description of your project", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "electron main.js" 8 | }, 9 | "author": "Our Code World", 10 | "license": "CC0-1.0", 11 | "devDependencies": { 12 | "electron-prebuilt": "^1.0.1" 13 | }, 14 | "dependencies": { 15 | "chokidar": "^1.5.1" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/electron-voicecommands-speechsynthesis/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ourcodeworldelectron", 3 | "version": "1.0.0", 4 | "description": "A quick description of your project", 5 | "main": "main.js", 6 | "scripts": { 7 | "start": "electron main.js" 8 | }, 9 | "author": "Our Code World", 10 | "license": "CC0-1.0", 11 | "devDependencies": { 12 | "electron-prebuilt": "^1.0.1" 13 | }, 14 | "dependencies": { 15 | "artyom.js": "^0.9.6" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/electron-webcamera/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const electron = require('electron'); 4 | const app = electron.app; // Module to control application life. 5 | const BrowserWindow = electron.BrowserWindow; // Module to create native browser window. 6 | 7 | // Keep a global reference of the window object, if you don't, the window will 8 | // be closed automatically when the JavaScript object is garbage collected. 9 | var mainWindow = null; 10 | 11 | // Quit when all windows are closed. 12 | app.on('window-all-closed', function() { 13 | // On OS X it is common for applications and their menu bar 14 | // to stay active until the user quits explicitly with Cmd + Q 15 | if (process.platform != 'darwin') { 16 | app.quit(); 17 | } 18 | }); 19 | 20 | // This method will be called when Electron has finished 21 | // initialization and is ready to create browser windows. 22 | app.on('ready', function() { 23 | // Create the browser window. 24 | mainWindow = new BrowserWindow({width: 800, height: 600}); 25 | 26 | // and load the index.html of the app. 27 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 28 | 29 | // Open the DevTools. 30 | mainWindow.webContents.openDevTools(); 31 | 32 | // Emitted when the window is closed. 33 | mainWindow.on('closed', function() { 34 | // Dereference the window object, usually you would store windows 35 | // in an array if your app supports multi windows, this is the time 36 | // when you should delete the corresponding element. 37 | mainWindow = null; 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /examples/electron-batch-childprocess/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const electron = require('electron'); 4 | const app = electron.app; // Module to control application life. 5 | const BrowserWindow = electron.BrowserWindow; // Module to create native browser window. 6 | 7 | // Keep a global reference of the window object, if you don't, the window will 8 | // be closed automatically when the JavaScript object is garbage collected. 9 | var mainWindow = null; 10 | 11 | // Quit when all windows are closed. 12 | app.on('window-all-closed', function() { 13 | // On OS X it is common for applications and their menu bar 14 | // to stay active until the user quits explicitly with Cmd + Q 15 | if (process.platform != 'darwin') { 16 | app.quit(); 17 | } 18 | }); 19 | 20 | // This method will be called when Electron has finished 21 | // initialization and is ready to create browser windows. 22 | app.on('ready', function() { 23 | // Create the browser window. 24 | mainWindow = new BrowserWindow({width: 800, height: 600}); 25 | 26 | // and load the index.html of the app. 27 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 28 | 29 | // Open the DevTools. 30 | mainWindow.webContents.openDevTools(); 31 | 32 | // Emitted when the window is closed. 33 | mainWindow.on('closed', function() { 34 | // Dereference the window object, usually you would store windows 35 | // in an array if your app supports multi windows, this is the time 36 | // when you should delete the corresponding element. 37 | mainWindow = null; 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /examples/electron-folderandfilewatcher/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const electron = require('electron'); 4 | const app = electron.app; // Module to control application life. 5 | const BrowserWindow = electron.BrowserWindow; // Module to create native browser window. 6 | 7 | // Keep a global reference of the window object, if you don't, the window will 8 | // be closed automatically when the JavaScript object is garbage collected. 9 | var mainWindow = null; 10 | 11 | // Quit when all windows are closed. 12 | app.on('window-all-closed', function() { 13 | // On OS X it is common for applications and their menu bar 14 | // to stay active until the user quits explicitly with Cmd + Q 15 | if (process.platform != 'darwin') { 16 | app.quit(); 17 | } 18 | }); 19 | 20 | // This method will be called when Electron has finished 21 | // initialization and is ready to create browser windows. 22 | app.on('ready', function() { 23 | // Create the browser window. 24 | mainWindow = new BrowserWindow({width: 800, height: 600}); 25 | 26 | // and load the index.html of the app. 27 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 28 | 29 | // Open the DevTools. 30 | mainWindow.webContents.openDevTools(); 31 | 32 | // Emitted when the window is closed. 33 | mainWindow.on('closed', function() { 34 | // Dereference the window object, usually you would store windows 35 | // in an array if your app supports multi windows, this is the time 36 | // when you should delete the corresponding element. 37 | mainWindow = null; 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /examples/electron-voicecommands-speechsynthesis/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const electron = require('electron'); 4 | const app = electron.app; // Module to control application life. 5 | const BrowserWindow = electron.BrowserWindow; // Module to create native browser window. 6 | 7 | // Keep a global reference of the window object, if you don't, the window will 8 | // be closed automatically when the JavaScript object is garbage collected. 9 | var mainWindow = null; 10 | 11 | // Quit when all windows are closed. 12 | app.on('window-all-closed', function() { 13 | // On OS X it is common for applications and their menu bar 14 | // to stay active until the user quits explicitly with Cmd + Q 15 | if (process.platform != 'darwin') { 16 | app.quit(); 17 | } 18 | }); 19 | 20 | // This method will be called when Electron has finished 21 | // initialization and is ready to create browser windows. 22 | app.on('ready', function() { 23 | // Create the browser window. 24 | mainWindow = new BrowserWindow({width: 800, height: 600}); 25 | 26 | // and load the index.html of the app. 27 | mainWindow.loadURL('file://' + __dirname + '/index.html'); 28 | 29 | // Open the DevTools. 30 | mainWindow.webContents.openDevTools(); 31 | 32 | // Emitted when the window is closed. 33 | mainWindow.on('closed', function() { 34 | // Dereference the window object, usually you would store windows 35 | // in an array if your app supports multi windows, this is the time 36 | // when you should delete the corresponding element. 37 | mainWindow = null; 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /examples/electron-batch-childprocess/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
10 | 
Use commands like :
12 |