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

Uncaught Error: Could not call remote function 'createNew' #55

Open
hevilp opened this issue Jan 24, 2018 · 5 comments
Open

Uncaught Error: Could not call remote function 'createNew' #55

hevilp opened this issue Jan 24, 2018 · 5 comments

Comments

@hevilp
Copy link

hevilp commented Jan 24, 2018

`<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 ....

@hevilp
Copy link
Author

hevilp commented Jan 24, 2018

I saw now:

#9

@a-sync
Copy link
Collaborator

a-sync commented Jan 25, 2018

@hevilp Just to be clear: did you also had to specify all the arguments to make this work?
var win2 = windowManager.createNew('win1', 'Windows 1', null, false, {}, false);
Like so?

Also: you should use .setURL() instead of .loadURL() before using .open().

@hevilp
Copy link
Author

hevilp commented Jan 25, 2018

Yes I specified all arguments.

@Cabeccar
Copy link

Delete win2.onReady(); and it will work, I had the same problem

@MarcKarasek
Copy link

How do you use onReady() properly.. I had same problem and deleted it but will need to use it as some point.

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

No branches or pull requests

4 participants