New-window event handler can return its own BrowserWindow instance #7407

Merged
merged 7 commits into from Oct 6, 2016

Projects

None yet

4 participants

@MichaelVasseur
Contributor

This pull request allows 'new-window' event handlers (running in the master process) to give back the BrowserWindow instance they created when the default behavior is prevented.

The suggested way to return this window is to set the new property newGuest with the newly created BrowserWindow. This may not be the best way to achieve this so others suggestions are welcome.

@deepak1556
Member

What scenario does this turn helpful ?

@MichaelVasseur
Contributor
MichaelVasseur commented Sep 29, 2016 edited

@deepak1556 In our application, we have a class that encapsulates BrowserWindow. For each new window, we must create one instance of our object and then return the encapsulated BrowserWindow.

@zcbenz
Contributor
zcbenz commented Oct 5, 2016

👍

@zcbenz
Contributor
zcbenz commented Oct 5, 2016

@MichaelVasseur I'm testing your change but the tests are failing, can you fix them?

Also notice that I just did a rebase of this branch from master branch, so you need to do a reset locally.

@MichaelVasseur
Contributor

@zcbenz Ah ok, I did the rebase locally but didn't pushed yet because of the failing tests.

MichaelVasseur added some commits Sep 16, 2016
@MichaelVasseur MichaelVasseur 'new-window' event handlers can return their window when default beha…
…vior is prevented
5a4cdcf
@MichaelVasseur MichaelVasseur Fix indentation 3408c80
@MichaelVasseur MichaelVasseur Updated the related documentation 22bd7c0
@MichaelVasseur MichaelVasseur Rebase with recent changes cc7f4fe
@MichaelVasseur MichaelVasseur Sets correct openerId in mergeBrowserWindowOptions() to give correct …
…options to 'new-window' event handler
a2b3cf9
@MichaelVasseur MichaelVasseur Fix JS Lint issues
9490ec7
@MichaelVasseur MichaelVasseur Fix errors
3dd41bc
@zcbenz
Contributor
zcbenz commented Oct 6, 2016

Thanks!

@zcbenz zcbenz merged commit 5285b72 into electron:master Oct 6, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@aluxian-huginn aluxian-huginn referenced this pull request in Aluxian/Messenger-for-Desktop Oct 6, 2016
Closed

Update dependency: electron v1.4.3 #723

@dogancelik

Can you show an example how to use this?
I want to get new window's WebContents
I think created window should be available in e.target, that would be awesome

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