amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Listen for an unload event from the viewer

Open ericfs opened this issue 10 years ago • 6 comments

The viewer will send an "unload" event to notify the doc that it is about to be unloaded.

This should cause a visibility state change so that analytics can flush itself.

Eventually this should also return saved state that can be used to restore the doc as described in: https://github.com/ampproject/amphtml/issues/1677

The response can be {'savedState': }.

ericfs avatar Feb 05 '16 15:02 ericfs

The message name we are using is "willUnload"

ericfs avatar Feb 05 '16 23:02 ericfs

@ericfs Please advise on priority.

rudygalfi avatar Feb 05 '16 23:02 rudygalfi

Higher than https://github.com/ampproject/amphtml/issues/1677 Discussed and agreed with @malteubl I think it would be very nice to have for overall stability.

ericfs avatar Feb 05 '16 23:02 ericfs

I mean @cramforce

ericfs avatar Feb 05 '16 23:02 ericfs

Name was changed to "willLikelyUnload" as there is a small chance the unload won't happen.

ericfs avatar Feb 08 '16 14:02 ericfs

@ericfs Is this still needed. I'm going to close assuming it's not, but please let us know if that's not true.

rudygalfi avatar Feb 18 '17 00:02 rudygalfi