It would be great if there was an event triggered before page:loading were document.location still points to the current url.
The problem is that when page:loading is triggered document.location already points to the new url, so it's hard to do cleanup like ubsubscribing from pubsub channels, calling deconstructors etc.
Turbolinks has a page:before-change event that can be used for that.
Another alternative would be to pass the old url to the page:loading event handler as an additional parameter.
It would be great if there was an event triggered before page:loading were document.location still points to the current url.
The problem is that when page:loading is triggered document.location already points to the new url, so it's hard to do cleanup like ubsubscribing from pubsub channels, calling deconstructors etc.
Turbolinks has a page:before-change event that can be used for that.
Another alternative would be to pass the old url to the page:loading event handler as an additional parameter.