tamkeen-tms / electron-window-manager Goto Github PK
View Code? Open in Web Editor NEWA NodeJs module that handles window management for Electron (Atom Shell, previously).
License: MIT License
A NodeJs module that handles window management for Electron (Atom Shell, previously).
License: MIT License
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:
Obviously, using the handler returned by bridge.on() just can't work.
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.
Please could use of windowManager.get('home').object.
be added to docs to help first time users understand how to access all electron functions
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');
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.
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.
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 . . .
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
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.
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?
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.
to save the window state when restart
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;
});
}`
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');
});
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!
},
It'd be awesome if there was an example that I could download and tinker around with.
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.
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
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. . .
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()
};
Has no effect:
` winOption = windowManager.createNew('options', 'Optionen', false, false, {
'width': 600,
'height': 170,
'resizable': true,
'showDevTools': true,
'destroyOnClose': true
});`
How can I view a list created by the 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
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.
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'
}
]
}
});
I'm getting this error when setting the onReady callback
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();
});
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?
In the renderer / DevTools, window.screen is a reserved DOM property, so writing let {screen} = require('electron') will not work. In our examples below, we use electronScreen as the variable name instead.
As a result...
https://github.com/azain/electron-window-manager/blob/master/index.js#L555
should read...
const {screen: electronScreen} = require('electron');
Thoughts?
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
npm ERR! No git binary found in $PATH
It would be nice if, in a renderer process, you could call something like:
windowManager.getCurrentWindowName()
And have it return the name associated with the BrowserWindow
For some strange reason relative urls not loading
<script src="/assets/js/jquery.js"></script>
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();
}
};
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...
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()
.
Has this project been abandoned?
If so it would be good to let folks know.
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();
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.
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.
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'
Hi,
is there any possibility to set the window on top of all windows?
I want use it, to bring it in the foreground.
Hi,
I have been looking for ways of sharing big amounts of data between electron windows. Your module how does this? Is there any limitation?
Thanks,
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.
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', {});
abandoned?
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
`<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 ....
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
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'.
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();')
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.