Launching renderer functions from the main menu in Electron-Vue

Creating menus is simple enough in Electron, but how in the world do you tell your Renderer process to do something?! I couldn’t find any existing resources on this so hopefully this helps you.

In your menu/index.js  set up your menu:

In your  renderer/main.js  add a listening function:

Tada! You can now successfully run any renderer function you like from your application menus. 🙂

Here’s some other types of ways you can communicate between the two processes: http://electron.rocks/different-ways-to-communicate-between-main-and-renderer-process/

2 thoughts on “Launching renderer functions from the main menu in Electron-Vue

    1. I had added it to the Vue prototype, but you can access Electron from the renderer process like this:

      const electron = require('electron')

Leave a Reply

Your email address will not be published. Required fields are marked *