Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require('electron') - issues? #20

Closed
toovy opened this issue Jan 21, 2016 · 4 comments
Closed

require('electron') - issues? #20

toovy opened this issue Jan 21, 2016 · 4 comments

Comments

@toovy
Copy link

toovy commented Jan 21, 2016

Hi felix,

I played around with this project and really appreciate it. Nevertheless I tried to open a dialog to let the user pick a file. Looking at the electron API this should be pretty straightforward.

https://github.com/atom/electron/blob/master/docs/api/dialog.md

When I call require('electron') there is no dialog property. What am I doing wrong?

Thanks a lot, BR, toovy

@felixrieseberg
Copy link
Collaborator

This is probably easy - if you're trying to call dialog from anywhere in Ember, you're no longer in the main process (and need to use remote). Simple example:

import Ember from 'ember';

export default Ember.Controller.extend({
    init: function () {
        var dialog = require('electron').remote.dialog;
        dialog.showErrorBox('Error', 'Hi!');
    }
});

I'm closing this in the meantime, but feel free to reopen if I misunderstood the situation 🐰

@toovy
Copy link
Author

toovy commented Jan 21, 2016

Works fine, thanks!

dialog = require('electron').remote.dialog
dir = dialog.showOpenDialog properties: [ 'openDirectory' ]

@BennyAlex
Copy link

BennyAlex commented Jun 14, 2017

@toovy @felixrieseberg
when I am using const {dialog} = require('electron').remote; OR const dialog = require('electron').remote.dialog; I get the following error:

File: electron-mp3-wizard/controllers/renamer.js
The Broccoli Plugin: [broccoli-persistent-filter:Babel > [Babel: electron-mp3-wizard]: Babel: electron-mp3-wizard] failed with:

TypeError: my-app/controllers/renamer.js: Property object of MemberExpression expected node to be of a type ["Expression"] but instead got null

@seansellek
Copy link

I am also seeing the issue BennyAlex mentioned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants