Giter Club home page Giter Club logo

electron-window-manager's People

Contributors

a-sync avatar alt-jero avatar autre31415 avatar dacardinal avatar daviditsygin avatar dravorle avatar evsar3 avatar gaoqiankun avatar jbithell avatar kaseyhinton avatar loicboyeldieu avatar parro-it avatar richstandbrook avatar shibacomputer avatar shrimpwagon avatar tamkeen-tms avatar tysenmoore-xse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

electron-window-manager's Issues

bridge.removeListener not works

I found the function bridge.removeListener() doesn't work and guess things going wrong because of the function bridge.on(), here is your code:

 'bridge': {
            /**
             * Sets the callback to trigger whenever an event is emitted
             * @param event The name of the event
             * @param callback The callback to trigger, this callback will be given the data passed (if any), and
             * the name of the targeted window and finally the name of the window that triggered/emitted the event
             * @return the handler that add into the event listeners array
             * */
            'on': function(event, callback){
                let id =  windowManager.eventEmitter.listenerCount(event);

                windowManager.eventEmitter.addListener(event, function(event){
                    callback.call(null, event.data, event.target, event.emittedBy);
                });

                return windowManager.eventEmitter.listeners(event)[id];
            },

The function bridge.on() wants to return a handler registered on specific event so that users can remove this listener later using this handler, however, this handler is just a copy of the REAL HANDLES according to NodeJS document:

image

Obviously, using the handler returned by bridge.on() just can't work.

Cannot read property 'on' of undefined

Get this error with this code:

var windowManager = require('electron-window-manager'); in main.js (renderer)

Error log:

Uncaught TypeError: Cannot read property 'on' of undefined
at eval (eval at (renderer.js:2119), :118:4)
at Object. (renderer.js:2119)
at webpack_require (renderer.js:661)
at fn (renderer.js:87)
at Object.eval (eval at (renderer.js:2112), :17:23)
at eval (eval at (renderer.js:2112), :1105:30)
at Object. (renderer.js:2112)
at webpack_require (renderer.js:661)
at fn (renderer.js:87)
at Vue$3.NewEmail (eval at (renderer.js:1445), :119:37)
at Vue$3.boundFn [as NewEmail] (eval at (renderer.js:749), :166:12)
at VueComponent.NewEmail (eval at (renderer.js:1520), :64:24)
at Proxy.boundFn (eval at (renderer.js:749), :166:12)
at click (eval at (renderer.js:2393), :29:13)
at HTMLAnchorElement.invoker (eval at (renderer.js:749), :1738:18)

Based on the above it seems it crashes here:

app.on('browser-window-focus', (e, win) => {
	if (windowsWithShortcuts.has(ANY_WINDOW)) {
		registerAllShortcuts(ANY_WINDOW);
	}

	if (!windowsWithShortcuts.has(win)) {
		return;
	}

	registerAllShortcuts(win);
});

If it matters I am using https://github.com/SimulatedGREG/electron-vue

Maybe a check needs to be added for app or something? Everything else works normally in my app so I don't think its anything on my end.

Add example to docs

Please could use of windowManager.get('home').object. be added to docs to help first time users understand how to access all electron functions

Typo in API docs

In the Class: windowManager.templates documentation, an example has the typo 'samll'

   windowManager.templates.set('samll', {
        'width': 600,
        'height': 350,
        'resizable': true,
        'layout': 'classy',
        'showDevTools': true,
        'title': 'App name, for small windows!', // Yeah, even the window title!
        'onLoadFailure': function(){ ... }
    });

    windowManager.open(false, false, 'welcom.html', 'small');
    windowManager.open(false, false, 'byebye.html', 'small');

when it should read

   windowManager.templates.set('small', {
        'width': 600,
        'height': 350,
        'resizable': true,
        'layout': 'classy',
        'showDevTools': true,
        'title': 'App name, for small windows!', // Yeah, even the window title!
        'onLoadFailure': function(){ ... }
    });

    windowManager.open(false, false, 'welcom.html', 'small');
    windowManager.open(false, false, 'byebye.html', 'small');

window.html() doesn't support HTML written in utf-8

This works: window.content().loadURL('data:text/html;charset=utf-8,' + html)

But implementation:

  Window.prototype.html = function(code, options){
        this.content().loadURL('data:text/html,' + code, options);
    };

doesn't give possibility to specify the charset.

I tried also to pass as options {extraHeaders: 'Content-Type: text/html; charset=utf-8\n'} , but that also doesn't work.

As solution I would suggest to add 3th parameter charset.

Can not launch window from render process

Same problem as this: #9

Should re-open that issue until fixed.

var myWindow = windowManager.createNew('myWindow', 'Stuff', false, false, false, false)
myWindow.loadURL('/login')
myWindow.open()

Uncaught Error: Could not call remote function ''. Check that the function signature is correct.

Is the documentation outdated? Because nothing I try works.

windowManger.bridge: No mechanism available to remove a listener

Although the windowManager.bridge module provides a mechanism to add a listener for an event (e.g. the 'on' method) there is no method to remove the listener. Since an anonymous function is actually used in the underlying EventEmitter.addListener() method (not the callback passed in to 'on') it is impossible to unregister from events once set. This anonymous wrapper function would have to be returned as a "handle" to provide any hope of removing a listener later (a call the current API doesn't support).

There is actually a bigger problem here that involves the scenario where two BrowserWindows (e.g. separate Renderer processes) wish to communicate using the bridge. Assume BrowserWindow A creates (via the 'remote' IPC services) a new BrowserWindow B and wishes to communicate from A to B. BrowserWindow B will register an 'on()' event handler while BrowserWindow A will use the bridge's emit() function to send it messages. This works great. The problem occurs when BrowserWindow B closes. There is no opportunity for BrowserWindow B to remove it's listener for the event emitted by BrowserWindow A. Should BrowserWindow A create a new instance of BrowserWindow B (which adds the same event listener again), internally, the EventEmitter now has TWO handlers registered for the event in question. One listener for a (previously closed) BrowserWindow B and a new one for the recently re-created BrowserWindow B. When BrowserWindow A calls emit() an exception is thrown warning that a message is trying to be sent to a BrowserWindow (B) that is closed and destroyed. Because of this exception the event never gets to the newly re-created BrowserWindow B.

The windowManager.bridge module almost needs to monitor the life-times of each window it manages. It does this to remove windows from it's list of open windows but that is not enough. On 'close' it would likely need to scan the list of listeners looking for handlers on Renderer processes that are no longer available. I don't think the Render process can do this itself because it's likely too late (once it catches the 'close' event) to make a remote IPC call to the windowManager singleton to remove it's handlers.

For now, I've added my own method to windowManager.bridge that simple removes ALL the listeners for a given event. So BrowserWindow A adds a listener for BrowserWindow B closing. When it gets this indication it removes ALL listeners for this event.

'removeAllListeners': function(event) {
                windowManager.eventEmitter.removeAllListeners(event);
            },

This works in my scenario (e.g. I don't get the exception any longer) but it is rather draconian - especially if there were other BrowserWindows that are not closing and are registered to receive the same event. In that case, their event listeners would no longer be called.

I'm hoping you can suggest a different approach to handle this problem, or at a minimum, at least provide the method (above) on the bridge to be able to remove all listeners for a given event. A better solution would be to remove all handlers for a given event on a specific BrowserWindow although it's not clear if this is possible.

I hope you can offer some advice here . . .

Can we have different icon for each window?

I want to create a complete software package using electron and i have sub apps inside the main app for which i want different icons so can we add custom icon to the newly created window using this package

Layouts Break Window Load

I tried to implement a layout for one of my windows, but when I try to open the window with a layout it fails with the "unable to load application interface" error.

I initialize the layout in my main process with:
windowManager.init({ ..... layouts: { default: 'layout.html' } });

and when I open the window I open it with:
var win2 = windowManager.open(false, appName, url, false, { frame: false, show: false, useContentSize: true, webPreferences: { preload: preload }, layout: 'default' }); ..... win2.object.show();

It doesn't matter what I put in the layout.html file, I have tried just pasting what is in the README.md example and it doesn't work.

Crashes when using require() due to syntax error

Sorry, couldn't come up with a better title.

Anyway, it crashes when I use require() in my electron.js file and gives me the following syntax errors:

/Users/Bossehasse/projects/vagranti_testing/node_modules/electron-window-manager/index.js:1096
                      'emit': function(event, data, target){
                      ^^^^^^
          SyntaxError: Unexpected string
              at Object.exports.runInThisContext (vm.js:76:16)
              at Module._compile (module.js:528:28)
              at Object.Module._extensions..js (module.js:565:10)
              at Module.load (module.js:473:32)
              at tryModuleLoad (module.js:432:12)
              at Function.Module._load (module.js:424:3)
              at Module.require (module.js:483:17)
              at require (internal/module.js:20:19)
              at Object.<anonymous> (/Users/Bossehasse/projects/vagranti_testing/app/electron.js:9:23)
              at Module._compile (module.js:556:32)
Uncaught Exception:
TypeError: Cannot read property 'bridge' of undefined
    at Object.<anonymous> (/Users/Bossehasse/projects/vagranti_testing/node_modules/electron-window-manager/index.js:1077:41)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/Bossehasse/projects/vagranti_testing/app/electron.js:9:23)
    at Module._compile (module.js:556:32)

    // index.js
        'bridge': {
            'on': function(event, callback){
                let id =  windowManager.eventEmitter.listenerCount(event);

                windowManager.eventEmitter.addListener(event, function(event){
                    callback.call(null, event.data, event.target, event.emittedBy);
                });

                return windowManager.eventEmitter.listeners(event)[id];
            },

            'addListener': windowManager.bridge.on, // <---- Properties can't be added like this, it says that windowManager is undefined.

            'removeListener': function(event, handler) {
                windowManager.eventEmitter.removeListener(event, handler);
            } // <----- a "," is missing.

            'emit': function(event, data, target){
                windowManager.eventEmitter.emit(event, {
                    'emittedBy': windowManager.getCurrent().name,
                    'target': target,
                    'data': data
                });
            }
        }

I'm using version 1.0.2 which is the latest, I believe?

Layout path not work

Currently, utils.getAppLocalPath() will return a path point to \node_modules\electron\dist\resources\default_app.asar, which is a asar file,
but not a folder. This caused all layout settings failed.

Not possible to open a closed window

Hi,

I create a window, after closing it, I cannot open it again. Console says its already exists. Is there anyway to tell it, its closed?
`
function create_optionen() {
// Create a new window
winOption = windowManager.createNew('options', 'Optionen', false, false, {
'width': 600,
'height': 170,
'resizable': true
});
//win1.registerShortcut('CTRL+N', function(){
winOption.setURL(optionpfad);
winOption.open();
winOption.loadURL(optionpfad);
winOption.on('closed', () => {
winOption.destroy();
winOption.close();
winOption = null;
});

}`

Unable to load the application interface

I'm just trying out this package, it looks promising but i can't even get a simple window to work.

Using basic code:

const {app, BrowserWindow} = require('electron');
const windowManager = require('electron-window-manager');

app.on('window-all-closed', function() {
    if (process.platform != 'darwin')
        app.quit();
});

app.on('ready', function() {
    windowManager.init();
    windowManager.setDefaultSetup({'width': 600, 'height': 450, 'position': 'right'});
    windowManager.open('main', 'main test', './index.html');
});

I get the following error:
screenshot 2019-01-11 at 16 00 12

windowManager.getCurrent() - Doesn't return a window.

Uncaught Error: Could not call remote function 'emit'. Check that the function signature is correct. Underlying error: Cannot read property 'id' of undefined
Error: Could not call remote function 'emit'. Check that the function signature is correct. Underlying error: Cannot read property 'id' of undefined
    at callFunction (/Users/Bossehasse/projects/vagranti_testing/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/rpc-server.js:235:11)
    at EventEmitter.<anonymous> (/Users/Bossehasse/projects/vagranti_testing/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/rpc-server.js:342:5)
    at emitMany (events.js:127:13)
    at EventEmitter.emit (events.js:201:7)
    at WebContents.<anonymous> (/Users/Bossehasse/projects/vagranti_testing/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/api/web-contents.js:231:13)
    at emitTwo (events.js:106:13)
    at WebContents.emit (events.js:191:7)

The path to the ID is wrong:

'getCurrent': function(){
            var thisWindow = BrowserWindow.getFocusedWindow();
            if(!thisWindow) return false;

            // return this.getById(thisWindow.object.id); <--- Original
            return this.getById(thisWindow.id); // Now it works!
        },

Example project?

It'd be awesome if there was an example that I could download and tinker around with.

Layout and VS Code problem

I'm using VS Code.

To be able debug it, i specified a parameter in the launch.json
"runtimeExecutable": "${workspaceRoot}\\node_modules\\electron-prebuilt\\dist\\electron.exe",

The problem is with layouts, the add method uses utils.getAppLocalPath() which references to electron-prebuilt path, so when it loads the layout file is not found.
'add': function(name, path){ this.layouts[name] = utils.getAppLocalPath() + path; },
I comments utils.get... and it works correctly.

asar can't find module melanke-watchjs

when pack source as a asar file,
run projectname.exe,
there was an error , Error, cant find module melanke-watchjs,

in electron-window-manager package.json ,
`
"dependencies": {

"electron-localshortcut": "^0.6.0",

"underscore": "^1.8.3",

"watchjs": "git+https://github.com/melanke/Watch.JS.git"

}
`

in index.js
const WatchJS = require('melanke-watchjs');

npm list

it is show

+-- [email protected]
| +-- [email protected] extraneous (git+https://github.com/melanke/Watch.JS.git#ea157a742c819638a8ecc9fce24e7dba39379d3c)

so maybe this cause error

my:

Electron 1.4.13

Watch.JS name change has broken your name

Recently (two days ago) the Watch.JS developer changed the name of his module to melanke-watchjs. This has broken the require() in index.js. Could you please fix your module to reflect this change?

Thanks. . .

Window.currentURL() does not work.

Uncaught Error: Could not call remote function ''. Check that the function signature is correct. Underlying error: this.content(...).getUrl is not a function
Error: Could not call remote function ''. Check that the function signature is correct. Underlying error: this.content(...).getUrl is not a function
    at callFunction (/Users/Bossehasse/projects/vagranti_testing/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/rpc-server.js:235:11)
    at EventEmitter.<anonymous> (/Users/Bossehasse/projects/vagranti_testing/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/rpc-server.js:342:5)
    at emitMany (events.js:127:13)
    at EventEmitter.emit (events.js:201:7)
    at WebContents.<anonymous> (/Users/Bossehasse/projects/vagranti_testing/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar/browser/api/web-contents.js:231:13)
    at emitTwo (events.js:106:13)
    at WebContents.emit (events.js:191:7)

The issue seems to be because of a misspelling:

// index.js line 351
Window.prototype.currentURL = function(){
        return this.content().getUrl(); // <--- Should be getURL()
    };

destroyOnClose has no effect

Has no effect:
` winOption = windowManager.createNew('options', 'Optionen', false, false, {
'width': 600,
'height': 170,
'resizable': true,
'showDevTools': true,
'destroyOnClose': true

});`

Hiding Windows

Greetings,

just got into this neat module but immediately got stuck when I couldn't find a "hide" function for the WindowManager. Am I actually just missing it or is there no such thing as hide and show?

And if not, is it planned or possible to add?

I got around with simply calling WindowManager.windows.Main.object.hide(); so it's not really that much of a problem but I thought I'd ask ~

Edit: Sorry, totaly useless issue now, created a pull request for both functions

importList doesnt seem to work.

Hello sir iam trying to use the command windowManager.importList(file) ...the first time i take the page from the json file it opens normally...but if i close the window from default menu bar i cant reopen it it says
mainpage.js:40 Uncaught TypeError: managerwindow.open is not a function
at HTMLAnchorElement.

TypeError: Invalid Menu

I cannot seem to create a new menu. I'm getting this error:

Exception has occurred: TypeError
TypeError: Invalid Menu
    at Window.create (/home/username/projects/test-app/node_modules/electron-window-manager/index.js:193:25)
    at Window.open (/home/username/projects/test-app/node_modules/electron-window-manager/index.js:230:14)
    at Object.open (/home/username/projects/test-app/node_modules/electron-window-manager/index.js:877:31)
    at App.onReady (/home/username/projects/test-app/src/index.js:18:17)
    at emitTwo (events.js:111:20)
    at App.emit (events.js:194:7)

The Test App will work if I remove the menu...

Code:

windowManager.open('index', 'Test App', `file://${__dirname}/index.html`, false, {
    'width': 600,
    'height': 350,
    'resizable': false,
    'showDevTools': false,
    'title': 'Test App',
    'menu': {
      label: 'File',
      submenu: [
        {
          label: 'Quit',
          accelerator: 'CmdOrCtrl+Q',
          click: function(){app.quit();}
        }
      ],
      label: 'Developer Tools',
      submenu: [
        {
          label: 'Toggle DevTools',
          accelerator: 'CmdOrCtrl+I',
          click: function(item, focusedWindow){focusedWindow.toggleDevTools();}
        },
        {
          role: 'reload'
        }
      ]
    }
  });

onReady: Cannot read property 'webContents' of null

I'm getting this error when setting the onReady callback

image

app.on('ready', function(){
  windowManager.init();
  // Create Main Window Instance
  var mainWindow = windowManager.createNew('main', 'Main Window', app.getAppPath() + '\\out\\main-window.html', false, {
    width: 800,
    height: 600
  }, true);
  // Register on ready callback
  mainWindow.onReady(true, window => {
    console.log('main ready!');
  });
  // Open Main Window
  mainWindow.open();
});

Issue adding listeners to main window.

I am having a lot of difficulty adding listeners to my main window. I had this application working properly before trying to change everything over into using window manager. The key parts of my code that aren't working are here where I assign the new window to a variable "mainWindow"
var mainWindow = windowManager.createNew('home', 'welcome', file://${__dirname}/index.html);

and here where I have listeners for them
mainWindow.on('minimize',function(event){
event.preventDefault()
mainWindow.hide();
});

mainWindow.on('close', function (event) {
    if( !app.isQuiting){
        event.preventDefault()
        mainWindow.hide();
    }

I get an error that says mainWindow.on() is not a function. is what windowManager returns not a browser window?

Log options

Currently when a window is open / closed a message is logged to the console, I'd like to customize this message (Via a custom onOpen / onClose function when creating the window) or completly disable the log

Relative Urls

For some strange reason relative urls not loading

<script src="/assets/js/jquery.js"></script>

Initialize the window without showing it

I have a few of my windows hidden until they need to be shown, but they need to run in the background in the meantime.

I'm currently accomplishing that by adding a hide parameter to your Window.prototype.open function.

Is this something you would consider adding so that I can deploy with your npm package instead of a modified version?

    Window.prototype.open = function(url, hide){
        // If the window is already created
        if(_.isObject(this.object)){
            this.focus();
            return false;
        }

        // Create the window
        this.create(url);

        if (!hide) {
          // Show the window
          this.object.show();
        }
    };

clone doesnt work with windows.json properties...

I got my properties of all the windows on a json file...when i close one window with a specific page name from windows.json i cant reopen it...so i thought before each time i reopen it to clone it...but i cant figure it out...

Window.object is null after using windowManager.createNew()

So this is my code:

trayWindow = windowManager.createNew('tray', 'Tray', `${config.url}/tray.html`, null, {
    width: 1000,
    height: 600,
    frame: false,
    resizable: false,
    moveable: false,
    show: false,
    position: 'topLeft'
}, true)

console.log('trayWindow.object:', trayWindow.object) // trayWindow.object: null

Is this how it should be? If I do this:

trayWindow.create()
console.log('trayWindow.object:', trayWindow.object) // trayWindow.object: BrowserWindow

everything is fine. Just curious if all is as it should be. Seems odd to me that object doesn't get set during createNew().

Error when creating a window from rendered process

Uncaught Error: Could not call remote function ''. Check that the function signature is correct. Underlying error: Cannot read property 'webContents' of null
Error: Could not call remote function ''. Check that the function signature is correct. Underlying error: Cannot read property 'webContents' of null
    at callFunction (D:\Reactron\node_modules\electron-prebuilt\dist\resources\electron.asar\browser\rpc-server.js:225:11)
    at EventEmitter.<anonymous> (D:\Reactron\node_modules\electron-prebuilt\dist\resources\electron.asar\browser\rpc-server.js:306:5)
    at emitMany (events.js:127:13)
    at EventEmitter.emit (events.js:201:7)
    at EventEmitter.<anonymous> (D:\Reactron\node_modules\electron-prebuilt\dist\resources\electron.asar\browser\api\web-contents.js:165:13)
    at emitTwo (events.js:106:13)
    at EventEmitter.emit (events.js:191:7)

code:

var remote = require('electron').remote;
    console.log(remote);
    const {
      app
    } = remote.require('electron');
    var windowManager = remote.require('electron-window-manager');

    console.log('main window script');

    console.log('create');
    // Create a new window
    var win2 = windowManager.createNew('win2', 'Windows #2');
    win2.loadURL(app.getAppPath() + '\\out\\modal\\process-modal.html');
    win2.open();

Cannot find module 'melanke-watchjs'

Hello,
The module is displaying the following error:

Error: Cannot find module 'melanke-watchjs'

The solution is to change the dependency module name on require:

// index.js

// from
const WatchJS = require('melanke-watchjs');

// to
const WatchJS = require('watchjs');

Ps.: Probably you upgraded to npm * (version 1.0.4) * but did not upgrade to github * (version 1.0.1) *, therefore it is not possible to send pull request.

Cannot hide/show a window from another window

I am not sure if I am missing something, but I do not see a way to hide/show a window using the windowManager. In the second window I have access to the windowManager via remote:
var windowManager = remote.require('electron-window-manager');

however, there is no way for me to simply hide the first window. I am able to close the second window like this:
windowManager.windows.first.close()
Or like this:
windowManager.close('home');

But that seems to destroy the window and I cannot open it again. How can I toggle the visibility of a window from another window?

I know electron has a default way of hiding a window like this:
win.hide()

But this does not seem to be doably via the window manager.

Any help is really appreciated.

annot find module 'remote'

Using this code :

<script> var remote = require('remote'); var windowManager = remote.require('electron-window-manager'); // Create a new window var win2 = windowManager.createNew('win2', 'Windows #2'); win2.setURL('/window2.html'); win2.onReady({}); win2.open(); </script>

I keep getting the following:
Cannot find module 'remote'

Request: Set window on top

Hi,
is there any possibility to set the window on top of all windows?
I want use it, to bring it in the foreground.

Please update the code on npm to match the github repository

Hi there,
the current github commit is way behind the code in npm (1.0.1 vs 1.0.4).

This is causing a lot of issues for people who are unaware of this, and try to use / improve the code.
It also makes it impossible to send in pull requests for the most recent version.

Please make the time and update this repo to reflect npm!

Thanks.

windowManager emit getting error

  • Electron version: 1.6.1
  • Operating system: Window 7 - 64bit

Expected behavior

send data one window to another window using windowManager.bridge.emit

Actual behavior

Uncaught Error: Could not call remote function 'emit'. Check that the function signature is correct. Underlying error: Cannot read property 'id' of undefined
Error: Could not call remote function 'emit'. Check that the function signature is correct. Underlying error: Cannot read property 'id' of undefined
at callFunction (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\browser\rpc-server.js:259:11)
at EventEmitter. (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\browser\rpc-server.js:366:5)
at emitMany (events.js:127:13)
at EventEmitter.emit (events.js:201:7)
at WebContents. (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\browser\api\web-contents.js:249:37)
at emitTwo (events.js:106:13)
at WebContents.emit (events.js:191:7)
at callFunction (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\browser\rpc-server.js:259:11)
at EventEmitter. (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\browser\rpc-server.js:366:5)
at emitMany (events.js:127:13)
at EventEmitter.emit (events.js:201:7)
at WebContents. (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\browser\api\web-contents.js:249:37)
at emitTwo (events.js:106:13)
at WebContents.emit (events.js:191:7)
at metaToValue (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\renderer\api\remote.js:218:13)
at Object.remoteMemberFunction (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\renderer\api\remote.js:114:18)
at setSmartFoxInstance (http://localhost:9000/scripts/services/deskTileView.js:751:34)
at http://localhost:9000/scripts/services/deskTileView.js:199:33
at CallbacksRegistry.apply (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\common\api\callbacks-registry.js:48:42)
at EventEmitter. (C:\Users\Sandeep\AppData\Roaming\npm\node_modules\electron\dist\resources\electron.asar\renderer\api\remote.js:283:21)
at emitThree (events.js:116:13)
at EventEmitter.emit (events.js:194:7)

How to reproduce

open any window using windowManager e.g.
let myWindow = windowManager.open('home1', "welcom", 'http://localhost:9000/**.html', null, null, true);

after onReady calll
windowManager.bridge.emit('new_chat_message', {});

Handlebars added in code but not in dependencies (is it even necessary?)

Hi there,
the following pull request was merged to fix issue #28 or #29 not sure.
https://github.com/TamkeenLMS/electron-window-manager/pull/29/files

Other than the fact that the dependency is missing from package.json and that it's not actually using the created layoutUrl variable i wonder if handlebars is necessary (or was even intended to be included) for this fix.
Seems like a pretty big commitment and a bit of an overkill for this.

@DaCardinal might be using it in other user code, not sure about the reasons.

Kind regards,
a-sync

Uncaught Error: Could not call remote function 'createNew'

`<script>
const path = require('path');
const fs = require('fs');
const app = require('electron').remote.app;
const cp = require('child_process');
const remote = require('electron').remote;

var win1pfad = path.join(__dirname, "win1.html");
var windowManager = remote.require('electron-window-manager');

function create_win1() {
// Create a new window
var win2 = windowManager.createNew('win1', 'Windows 1');
win2.loadURL(win1pfad);
win2.onReady();
win2.open();
}
document.getElementById("btnwin1").onclick = create_win1;
</script>`

Uncaught Error: Could not call remote function 'createNew'. Check that the function signature is correct. Underlying error: Cannot read property 'focus' of null
Error: Could not call remote function 'createNew'. Check that the function signature is correct. Underlying error: Cannot read property 'focus' of null at callFunction ....

maximize seems not working

Hi,
I'm trying use maximize function and it seems totally not working.
I tested it on mac and it produces error.
the minimize function works well.
Thanks

Typo in README

I know this is quite trivial but there is a typo in README doc. At the very beginning under the list of APIs, 'sharedDate' should be changed to 'sharedData'.

window execute code

Can the window.execute method run a function instead of sending the code to be executed as a string? window.execute(function() { test(); }) instead of window.execute('test();')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.