blob: fe6bb56df4c6b2e45240392d05e847070aee128e [file] [log] [blame]
Sui Chenb65280f2020-06-30 18:14:03 -07001// All of the Node.js APIs are available in the preload process.
2// It has the same sandbox as a Chrome extension.
3
4const dialog = require('electron').remote.dialog; // Must add "remote"
5
6window.addEventListener('DOMContentLoaded', () => {
7 const replaceText = (selector, text) => {
8 const element = document.getElementById(selector);
9 if (element) element.innerText = text;
10 };
11
12 for (const type of ['chrome', 'node', 'electron']) {
13 replaceText(`${type}-version`, process.versions[type]);
14 }
15})
16
17console.log(document.getElementById('btn_open_file'));