You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@actionsetupWindowListener(){/* setup */letcleanup=newAbortController();let{ signal }=cleanup;window.addEventListener('beforeunload',this.handleUnload,{ signal })/* tear down */registerDestructor(cleanup,cleanup.abort);}
The text was updated successfully, but these errors were encountered:
I think registerDestructorneedsthis as a first parameter. I believe it needs this to have it participate in the component tear down right?
@actionsetupWindowListener(){/* setup */letcleanup=newAbortController();let{ signal }=cleanup;window.addEventListener('beforeunload',this.handleUnload,{ signal })/* tear down */registerDestructor(this,()=>cleanup.abort);}
Also in this simple example you can get away with an extra object creation:
@actionsetupWindowListener(){/* setup */letcleanup=newAbortController();window.addEventListener('beforeunload',this.handleUnload,cleanup)/* tear down */registerDestructor(this,()=>cleanup.abort);}
From @sukima: https://tritarget.org/#examples%2Fpage-unload-management%2Fevent-handler-abort
Instead of:
Maybe this?
The text was updated successfully, but these errors were encountered: