web: close shared service on window close

This commit is contained in:
Abdullah Atta
2024-05-09 10:30:46 +05:00
parent 714ac2deac
commit cb27039245

View File

@@ -75,6 +75,10 @@ export class SharedService<T extends object> extends EventTarget {
{ signal: this.#onClose.signal }
);
window.addEventListener("beforeunload", () => {
this.close();
});
this.proxy = this.#createProxy();
}