-
-
Save jeremyspiegel/36925a2377d0b8c7c67abd9816c2f411 to your computer and use it in GitHub Desktop.
test
This file contains 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
const {app, BrowserWindow} = require('electron') | |
const http = require('http') | |
http | |
.createServer((request, response) => { | |
if (request.url === '/popup') { | |
response.writeHead(200, {'content-type': 'text/plain; charset=utf-8'}) | |
response.end('test') | |
} else { | |
response.writeHead(200, {'content-type': 'text/html; charset=utf-8'}) | |
response.end(`<html><body><button onclick="window.open('/popup')">Open Window</button></body></html>`) | |
} | |
}) | |
.listen(2000); | |
app.whenReady().then(() => { | |
const mainWindow = new BrowserWindow({width: 200, height: 200}) | |
mainWindow.webContents.setWindowOpenHandler(() => ({action: 'allow'})) | |
mainWindow.loadURL('http://localhost:2000') | |
}) |
This file contains 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": "exciting-spring-drink-8h31j", | |
"productName": "exciting-spring-drink-8h31j", | |
"description": "My Electron application description", | |
"keywords": [], | |
"main": "./main.js", | |
"version": "1.0.0", | |
"author": "jeremyspiegel", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"electron": "22.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment