Sui Chen | b65280f | 2020-06-30 18:14:03 -0700 | [diff] [blame^] | 1 | // All of the Node.js APIs are available in the preload process. |
| 2 | // It has the same sandbox as a Chrome extension. |
| 3 | |
| 4 | const dialog = require('electron').remote.dialog; // Must add "remote" |
| 5 | |
| 6 | window.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 | |
| 17 | console.log(document.getElementById('btn_open_file')); |