Commands to start the app:
npm i
npm start
Created
October 23, 2020 15:14
-
-
Save ckerr/590c60135fa3e969a53aeea7c545d1ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' https: ws: data: blob:"> | |
| <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> | |
| <title>Electron sample</title> | |
| </head> | |
| <body> | |
| <p>Click the malformed url: </p> | |
| <a href="http://https%3B//github.com" target="_blank" rel="noopener noreferrer">http://https%3B//github.com</a> | |
| <p>Click the correct url: </p> | |
| <a href="https://github.com" target="_blank" rel="noopener noreferrer">https://github.com</a> | |
| <script type="text/javascript" src="renderer.js"></script> | |
| </body> | |
| </html> | |
| 'use strict'; | |
| const { app, BrowserWindow, shell } = require('electron'); | |
| const path = require('path'); | |
| const url = require('url'); | |
| let win; | |
| app.allowRendererProcessReuse = false; | |
| app.on('ready', () => { | |
| win = new BrowserWindow({ | |
| width: 600, | |
| height: 600, | |
| show: true, | |
| webPreferences: { | |
| nativeWindowOpen: true, | |
| nodeIntegration: true | |
| } | |
| }); | |
| win.loadURL(url.format({ | |
| pathname: path.join(__dirname, 'index.html') | |
| })); | |
| win.on('closed', () => { | |
| win = null | |
| }); | |
| win.webContents.on('new-window', (e ,url) => { | |
| e.preventDefault(); | |
| shell.openExternal(url); | |
| }); | |
| win.setMenu(null); | |
| win.webContents.openDevTools(); | |
| console.log(process.versions); | |
| }); | |
| { | |
| "name": "electron-sample", | |
| "version": "0.1.0", | |
| "description": "", | |
| "main": "main.js", | |
| "scripts": { | |
| "start": "./node_modules/.bin/electron .", | |
| "build": "rm -rf dist/ && electron-builder --x64", | |
| "reinstall": "rm -rf node_modules/ && npm i && npm start" | |
| }, | |
| "build": { | |
| "appId": "com.test.electron", | |
| "win": { | |
| "publisherName": [ | |
| "" | |
| ], | |
| "target": [ | |
| { | |
| "target": "portable" | |
| } | |
| ] | |
| }, | |
| "nsis": { | |
| "deleteAppDataOnUninstall": true, | |
| "packElevateHelper": false, | |
| "differentialPackage": false | |
| } | |
| }, | |
| "repository": { | |
| "type": "git", | |
| "url": "git+https://github.com/Sergey-Churilin/electron-sample.git" | |
| }, | |
| "devDependencies": { | |
| "electron": "10.1.4", | |
| "electron-builder": "22.9.1" | |
| } | |
| } | |
| ## Electron sample | |
| **Commands to start the app:** | |
| ```npm i``` | |
| ```npm start``` | |
| console.log('script!'); | |
| var electron = require('electron'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' https: ws: data: blob:"> | |
| <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> | |
| <title>Electron sample</title> | |
| </head> | |
| <body> | |
| <p>Click the malformed url: </p> | |
| <a href="http://https%3B//github.com" target="_blank" rel="noopener noreferrer">http://https%3B//github.com</a> | |
| <p>Click the correct url: </p> | |
| <a href="https://github.com" target="_blank" rel="noopener noreferrer">https://github.com</a> | |
| <script type="text/javascript" src="renderer.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const { app, BrowserWindow, shell } = require('electron'); | |
| const path = require('path'); | |
| const url = require('url'); | |
| let win; | |
| app.allowRendererProcessReuse = false; | |
| app.on('ready', () => { | |
| win = new BrowserWindow({ | |
| width: 600, | |
| height: 600, | |
| show: true, | |
| webPreferences: { | |
| nativeWindowOpen: true, | |
| nodeIntegration: true | |
| } | |
| }); | |
| win.loadURL(url.format({ | |
| pathname: path.join(__dirname, 'index.html') | |
| })); | |
| win.on('closed', () => { | |
| win = null | |
| }); | |
| win.webContents.on('new-window', (e ,url) => { | |
| e.preventDefault(); | |
| shell.openExternal(url); | |
| }); | |
| win.setMenu(null); | |
| win.webContents.openDevTools(); | |
| console.log(process.versions); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "electron-sample", | |
| "version": "0.1.0", | |
| "description": "", | |
| "main": "main.js", | |
| "scripts": { | |
| "start": "./node_modules/.bin/electron .", | |
| "build": "rm -rf dist/ && electron-builder --x64", | |
| "reinstall": "rm -rf node_modules/ && npm i && npm start" | |
| }, | |
| "build": { | |
| "appId": "com.test.electron", | |
| "win": { | |
| "publisherName": [ | |
| "" | |
| ], | |
| "target": [ | |
| { | |
| "target": "portable" | |
| } | |
| ] | |
| }, | |
| "nsis": { | |
| "deleteAppDataOnUninstall": true, | |
| "packElevateHelper": false, | |
| "differentialPackage": false | |
| } | |
| }, | |
| "repository": { | |
| "type": "git", | |
| "url": "git+https://github.com/Sergey-Churilin/electron-sample.git" | |
| }, | |
| "devDependencies": { | |
| "electron": "10.1.4", | |
| "electron-builder": "22.9.1" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log('script!'); | |
| var electron = require('electron'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment