Created
January 19, 2023 16:28
-
-
Save Jarrio/e6da74e7ef46c58bf9ca7c219ee2b415 to your computer and use it in GitHub Desktop.
electron preload.js
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
// preload.js | |
// All the Node.js APIs are available in the preload process. | |
// It has the same sandbox as a Chrome extension. | |
window.addEventListener('DOMContentLoaded', () => { | |
const replaceText = (selector, text) => { | |
const element = document.getElementById(selector) | |
if (element) element.innerText = text | |
} | |
for (const dependency of ['chrome', 'node', 'electron']) { | |
replaceText(`${dependency}-version`, process.versions[dependency]) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment