cleanup
This commit is contained in:
parent
c4626edee4
commit
856ed3db93
3 changed files with 0 additions and 54 deletions
30
main.js
30
main.js
|
|
@ -1,30 +0,0 @@
|
||||||
const { app, BrowserWindow, ipcMain } = require('electron/main');
|
|
||||||
const path = require('node:path');
|
|
||||||
|
|
||||||
console.log('Hello from Electron 👋');
|
|
||||||
|
|
||||||
function createWindow() {
|
|
||||||
const win = new BrowserWindow({
|
|
||||||
width: 800,
|
|
||||||
height: 600,
|
|
||||||
webPreferences: {
|
|
||||||
preload: path.join(__dirname, 'preload.js'),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
win.loadFile('index.html');
|
|
||||||
// or use ctrl+shift+i
|
|
||||||
win.webContents.openDevTools();
|
|
||||||
// win.loadURL('chrome://gpu');
|
|
||||||
}
|
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
|
||||||
ipcMain.handle('ping', () => 'pong');
|
|
||||||
createWindow();
|
|
||||||
});
|
|
||||||
|
|
||||||
app.on('window-all-closed', () => {
|
|
||||||
// when not on mac
|
|
||||||
if (process.platform !== 'darwin') {
|
|
||||||
app.quit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
const { contextBridge, ipcRenderer } = require('electron');
|
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld('versions', {
|
|
||||||
node() { return process.versions.node; },
|
|
||||||
chrome() { return process.versions.chrome; },
|
|
||||||
electron() { return process.versions.electron; },
|
|
||||||
ping() { return ipcRenderer.invoke('ping'); }
|
|
||||||
});
|
|
||||||
|
|
||||||
15
renderer.js
15
renderer.js
|
|
@ -1,15 +0,0 @@
|
||||||
console.log("hello world! yooo");
|
|
||||||
|
|
||||||
const information = document.getElementById('info');
|
|
||||||
information.innerText = `This app is using Chrome (v${versions.chrome()}), Node.js (v${versions.node()}), and Electron (v${versions.electron()})`;
|
|
||||||
|
|
||||||
async function func() {
|
|
||||||
const response = await versions.ping();
|
|
||||||
console.log(response);
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
func().then(x => {
|
|
||||||
console.log("is this working? ", x);
|
|
||||||
});
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue