dotherightthing / focalpoint-multi-cropper

Add a focalpoint to an image and generate project-specific crops.
0 stars 0 forks source link

uiSelectFolder is undefined #25

Closed dotherightthing closed 1 year ago

dotherightthing commented 1 year ago
...
    {
      label: appName,
      submenu: [
        {
          label: 'Load images', click: () => { mainWindow.webContents.executeJavaScript('uiSelectFolder()'); }
        }
      ]
    }
  ];

  Menu.setApplicationMenu(Menu.buildFromTemplate(template));

This appears to be a bug introduced by refactoring - a clash between CommonJS and ESM.

The main thread needs to call a method in the renderer. This currently done with executeJavaScript.

But the renderer uses ESM so cannot expose its methods to the main thread.