Hey im working on a chatapp and i want to run an function before the window is being closed or refreshed i have found the following:
ready() {
window.addEventListener('beforeunload', this.leaving());
}
But that doesnt not run the function can anyone help me?