preload.js 605 B

123456789101112131415161718192021222324
  1. /*
  2. * @Author: fhj
  3. * @LastEditors: fhj
  4. * @Description:
  5. */
  6. // window.addEventListener('DOMContentLoaded', () => {
  7. // const replaceText = (selector, text) => {
  8. // const element = document.getElementById(selector)
  9. // if (element) element.innerText = text
  10. // }
  11. // for (const dependency of ['chrome', 'node', 'electron']) {
  12. // replaceText(`${dependency}-version`, process.versions[dependency])
  13. // }
  14. // })
  15. const {get,post} = require('./utils/index')
  16. const { contextBridge } = require('electron');
  17. contextBridge.exposeInMainWorld('nodeRequest', {
  18. get,
  19. post
  20. });