adopted-ember-addons / ember-electron

:zap: Build, test, compile and package desktop apps with Ember and Electron
https://ember-electron.js.org/
Other
805 stars 109 forks source link

requireNode #93

Closed dafinley closed 8 years ago

dafinley commented 8 years ago

Really nice library btw. I have this very simple code in a pods setup..and this particular file is in pods/components/ui/file-menu and I have had alot of problems getting any sort of Menu to appear. I can use the fs library but anytime I try to use the menu...the application dies. Any clues?

import Ember from 'ember';
const menu = requireNode('electron');
const fs = requireNode('fs');
const menu = requireNode('electron');

export
default Ember.Component.extend({
    buildMenu:function(){

        var m = {
                label:'Menu',
                submenu:[{label:'Dumbo Fish'}]
        };

        menu.setApplicationMenu(menu.buildFromTemplate(m));

    }.on('init'),
    actions: {

    }
});
felixrieseberg commented 8 years ago

No worries, you're just calling it wrong:

const {remote} = requireNode('electron');
const {Menu} = remote;
dafinley commented 8 years ago

Preciate it!!...and in case anybody else comes here that template object is an array of objects...


        var m =[ {
                label:'Menu',
                submenu:[{label:'Dumbo Fish'}]
        }];