Handle of Electron window in NG Desktop Client

Forum to discuss the new web client version of Servoy.

Handle of Electron window in NG Desktop Client

Postby dev-ws-011 » Tue Aug 04, 2020 3:20 pm

Hi All,

I am working with NG Desktop client application. I need to get handle of Electron window to bind some events to get triggers when they occur.

For example:
Code: Select all
var window = <electron window handle>; //how to get this handle?
window.on('before-quit', function(){
  // logic here.
});

Any help is highly appreciated.

Regards
Servoy Developer
dev-ws-011
 
Posts: 73
Joined: Fri Oct 21, 2016 8:23 am

Re: Handle of Electron window in NG Desktop Client

Postby jcompagner » Tue Aug 04, 2020 3:40 pm

you talk about making a service right? (so a ngclient/ngdesktop plugin)

then you should be able to do:

const remote = require ("electron").remote;

and then on remote i think you have getCurrentWindow()

some examples of using remote:

https://github.com/Servoy/ngdesktopfile ... ile.js#L17
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8829
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Handle of Electron window in NG Desktop Client

Postby dev-ws-011 » Fri Sep 04, 2020 12:16 pm

Thanks for the guidance.

Yes, I am making a service.

But still I am not able to configure events on this first electron window(screen launched when we start NG Desktop client), events such as 'on-close', 'before-quit', etc are not triggering.

We need to trigger an event when first electron window is closed to make some closing transactions.

Any help will be highly appreciated.

Regards
Servoy Developer
dev-ws-011
 
Posts: 73
Joined: Fri Oct 21, 2016 8:23 am

Re: Handle of Electron window in NG Desktop Client

Postby mboegem » Fri Sep 04, 2020 5:43 pm

Hi,

did you try using the idle service plugin for this?
This might be doing what you want, only for the browser window, not specifically the electron window.
Marc Boegem
Solutiative / JBS Group, Partner
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image

Partner of Tower - The most powerful Git client for Mac and Windows
User avatar
mboegem
 
Posts: 1743
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Handle of Electron window in NG Desktop Client

Postby dev-ws-011 » Thu Sep 17, 2020 7:13 am

Thanks for your guidance. I will try this and let you know the results.

Regards
Servoy Developer
dev-ws-011
 
Posts: 73
Joined: Fri Oct 21, 2016 8:23 am


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 5 guests