我刚刚发现了电子 js。我想创建可以帮助使用代理服务器打开网站的桌面应用程序。我尝试了以下代码,请帮助我。请评论任何工作示例。
const electron = require('electron');
const app = electron.app;
var BrowserWindow = require('browser-window');
electron.crashReporter.start();
var mainWindow = null;
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
app.quit();
}
});
app.on('ready', function() {
// without proxy simple
//var win = new BrowserWindow({ width: 800, height: 600, show: false });
//win.on('closed', function() {
// win = null;
//});
//
//win.loadURL('https://www.panduboys.com');
//win.show();
var win = new BrowserWindow({ width: 800, height: 600 });
win.loadUrl("http://www.panduboys.com");
var session = win.webContents.session
session.setProxy("http=190.98.162.22:8080", function() {
console.log('done proxy kind of things');
});
});