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

Add client "close" event #868

Closed
AshleyScirra opened this issue Apr 6, 2016 · 4 comments
Closed

Add client "close" event #868

AshleyScirra opened this issue Apr 6, 2016 · 4 comments

Comments

@AshleyScirra
Copy link

If a SW wants to map a clientId to some state, there's no good way to know when to remove the map key. Adding an event that is fired when a client is closed would make this simpler.

Note you can't use a WeakMap, since clients.get() returns a different Client object every time even for the same clientId, so the same client gets added as new keys every time (which IMO is a nasty gotcha).

@jakearchibald
Copy link
Contributor

We should consider this feature.

In the mean time, performing GC like this when you see navigation fetches works pretty well

@wanderview
Copy link
Member

It would need to be slightly different from "close". Currently the spec controls windows, not documents. So a client can be closed, but also just navigated to a non-controlled document. In that case the client still exists, but is no longer a controlling client.

Perhaps we could add events to Client for transition controlled vs non-controlled state.

@NekR
Copy link

NekR commented Apr 8, 2016

Also Ctrl/Cmd + Shift + T (re-open tab) restores previous state of the page & back/forward history navigation can perform just session state restore. So this cannot be just close event, because then you will need an open[-again] event.

@jakearchibald
Copy link
Contributor

#886 seems to have more detail

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

4 participants