preload.js 436 B

123456789101112
  1. // All of the Node.js APIs are available in the preload process.
  2. // It has the same sandbox as a Chrome extension.
  3. window.addEventListener('DOMContentLoaded', () => {
  4. const replaceText = (selector, text) => {
  5. const element = document.getElementById(selector)
  6. if (element) element.innerText = text
  7. }
  8. for (const type of ['chrome', 'node', 'electron']) {
  9. replaceText(`${type}-version`, process.versions[type])
  10. }
  11. })