Skip to content
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

Refreshing the page does not seem to unregister the connector #12

Open
bmatthieu3 opened this issue Nov 22, 2023 · 2 comments
Open

Refreshing the page does not seem to unregister the connector #12

bmatthieu3 opened this issue Nov 22, 2023 · 2 comments

Comments

@bmatthieu3
Copy link

Hi @mbtaylor,

Thank you for providing this very practical and easy to use js API. I am looking to use it in Aladin Lite
I noticed that the client remains in the hub list when I refresh the page https://astrojs.github.io/sampjs/examples/send.html
It disappears when I close the tab but still remain when I refresh the page. I suppose the unload event is not called or it is but a bug happens in the unregister maybe. Is there something I can do to avoid that ?

Thank you very much

@bmatthieu3
Copy link
Author

bmatthieu3 commented Nov 22, 2023

It seems listening to beforeunload properly disconnects the client:

window.addEventListener("beforeunload", (_) => {
    connector.unregister();
});

@mbtaylor
Copy link
Member

Hi @bmatthieu3, I'm pleased to hear that you are looking at SAMP connectivity in the fabulous Aladin Lite. It's a long time since I wrote this (which I wasn't expecting to turn into the de-facto standard implementation of SAMP from js), and it is entirely likely that the code is doing something unhelpful or stupid. Since I bet your javascript skills are about 1000x better than mine, it might be best if you can figure out what's going wrong here and try to fix it (if that ends up as a major rework/rewrite I won't complain). But if you're unable or unwilling to that's OK, let me know and I'll have a go at working out what's wrong.

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