I have a requirement to alert the user when they try to leave a form with unsaved changes. Our Napili forms are individual community pages so this means we need to detect/confirm (in Lightning) a page transition/navigation event.
Using the Lightning chrome extension I can see lots of good candidate events for this e.g. force:hidePanel, siteforce:changeView etc.
When I try to register a handler for these events, I can't even save the handler.
Is there an example of how to do this somewhere or is there a reliable (ideally supported) way of detecting navigation between community pages?
This is a follow-on from Fast js navigation in Communities using Lightning/Napili