preload.js 407 B

12345678910111213
  1. const remote = require('electron').remote;
  2. const {ipcRenderer} = require('electron');
  3. window.addEventListener('contextmenu', function (e) {
  4. e.preventDefault();
  5. if(e.path[0].src||e.path[0].href) {
  6. let data = {
  7. "tag": e.path[0].tagName,
  8. "href": e.path[0].href || null,
  9. "src": e.path[0].src || null,
  10. };
  11. ipcRenderer.send('elm', data)
  12. }
  13. });