Use Resources Outside of main.js

Asked

Viewed 92 times

1

My question is this: Is it possible to call a dialog.showOpenWindow out of the main.js file? I would like to perform a function that by clicking a specific button of my Browserwindow opens showOpenWindow and returns me the path of the specified file. I tried to do it outside main.js but javascript did not recognize the Electron commands. There’s some way to do it?

1 answer

0

You need to call the dialog using the Remote. The remote serves exactly to call the Main features to work within a Renderer.

I hope I helped your little doubt :p

const { remote } = require('electron');
const dialog = remote.dialog;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.