-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add beforeunload as first class window event #185
Conversation
Codecov Report
@@ Coverage Diff @@
## master #185 +/- ##
=========================================
- Coverage 93.54% 93.35% -0.2%
=========================================
Files 15 15
Lines 1364 1384 +20
Branches 229 235 +6
=========================================
+ Hits 1276 1292 +16
- Misses 88 92 +4
|
this.innerWindow.addEventListener(windowEventMap[eventName] || eventName, listener); | ||
if (eventName === "beforeunload") { | ||
this.innerWindow.addEventListener("close-requested", (e) => { | ||
const args = new EventArgs(this, "beforeunload", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This callback is not covered in the test and is the resulting loss of coverage
|
||
protected postProcessArgs(args: EventArgs) { | ||
if (args && typeof args.returnValue !== "undefined") { | ||
(<any>args.innerEvent).returnValue = args.returnValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
desktopJS events wrap the internal container events for usage consistency. The returnValue on the djs event args needs to be propagated back to the inner event for the specific container.
Delegate beforeunload event on concrete ContainerWindow to either underlying container implementation or window object. This pattern will facilitate creating your own non window based beforeunload in custom ContainerWindow derivations.
Follows semantics of window beforeunload by leveraging returnValue on the event argument.