Electron fidle Hypervanse gist

index.html

<!DOCTYPE html>
<html>
<head>
Hello World!
</head>
<body>

╔═══════════════════════════════════╗ ┌─[ SYSTEM ]─────────────────────────

║ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ ║ OS :: macOS 27.0 arm64
╚═══════════════════════════════════╝ Host :: Frederico’s MacBook Air
Kernel :: 27.0.0
╦ ╦╦ ╦╔═╗╔═╗╦═╗╦ ╦╔═╗╔╗╔╔═╗╔═╗ Uptime :: 9:19, 2 users, load averages: 5.34 6.71 9.53
╠═╣╚╦╝╠═╝║╣ ╠╦╝╚╗╔╝╠═╣║║║╚═╗║╣ Packages :: 297 (brew), 43 (brew-cask)
╩ ╩ ╩ ╩ ╚═╝╩╚═ ╚╝ ╩ ╩╝╚╝╚═╝╚═╝ Shell :: zsh 5.9 (arm64-apple-darwin26.0)
Terminal :: Apple_Terminal 488
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ├─[ HARDWARE ]───────────────────────
E X T E N D E D R E N T E R M CPU :: Apple M1
cyan-forward · no red/green reliance GPU :: Graphics/Displays:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Memory :: 5 GiB / 8 GiB (74%)
Disk (/) :: not available
🩸 root access granted — est. 1994 Disk (/Volumes/1T-APFS) :: mounted
├─[ LANGUAGES ]──────────────────────
Python :: 3.14.6
Node :: v26.7.0
Ruby :: 2.6.10p210
Go :: go1.26.5
Rust :: 1.97.1
Cargo :: 1.97.1
└────────────────────────────────────
● ● ● ● ● ● ● ●
Commands :: manview rust_info open_docs hv_help
open_cargo_book open_mandible_repo
Rust CLI :: eza bat fd rg z delta dust procs btm</h1>
We are using Node.js ,
Chromium ,
and Electron .
</p>
</body>
</html>

main.js

const { app, BrowserWindow } = require('electron/main')
const path = require('node:path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})

package.json

{
"name": "malicious-kittens-warn-c4xfc",
"productName": "malicious-kittens-warn-c4xfc",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "fredericomoreira",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "43.4.0"
}
}

preload.js

window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector, text) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const type of ['chrome', 'node', 'electron']) {
replaceText(`${type}-version`, process.versions[type])
}
})

renderer.js

/**
* This file is loaded via the
* be executed in the renderer process for that window. No Node.js APIs are
* available in this process because `nodeIntegration` is turned off and
* `contextIsolation` is turned on. Use the contextBridge API in `preload.js`
* to expose Node.js functionality from the main process.
*/
添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论