Skip to content

Conflict using window.onbeforeunload #53

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

Open
brickgale opened this issue May 18, 2017 · 2 comments
Open

Conflict using window.onbeforeunload #53

brickgale opened this issue May 18, 2017 · 2 comments

Comments

@brickgale
Copy link

I'm using window.onbeforeunload to open a popup or confirmation alert to leave the web app, I notice that when I run window.onbeforeunload on devtools console, it returns skyway's function, not the function i provided to show and alert. Is there a way to override it?

@brickgale
Copy link
Author

brickgale commented May 19, 2017

I override it with my own function, now my problem is how do i get the previous function work as it always do. window.onbeforeunload=function(b){a.destroy()}} on https://skyway.io/dist/0.3/peer.js...

It seems it needs window.onbeforeunload to close some sockets.

@yusuke84
Copy link
Member

In the window.onbeforeunload event, processing to disconnect from the signaling server is being executed. The reasons are as follows.

    // Close sockets before unloading window
    // Necessary as sometimes the brower does not close ws / xhr property
    // especially for FF

Ref: https://github.com/nttcom/peerjs/blob/master/lib/peer.js#L145

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

No branches or pull requests

2 participants