An angular 4 app. If I close the browser window, will that call the on destory lifecycle hook? Is there a way to act on the browser close action if not?
Why?
disconnection of web sockets
An angular 4 app. If I close the browser window, will that call the on destory lifecycle hook? Is there a way to act on the browser close action if not?
Why?
disconnection of web sockets
OnDestroy does NOT react when you close the window. Although you can hook to the browser window event
@HostListener('window:beforeunload', ['$event'])
handleBeforeUnload(event) {
this.unsubscribeFromWhatever();
}
This way you can collect garbage from you app