Remove "unload" event?

Another item that Google Chrome's Lighthouse complains about is the presence of an "unload" event listener. I don't know why it is included in the project, but it can be manually removed from the resulting JavaScript file without any apparent side effects after the project is compiled.


    this.BindEvents = function () {
      var pc = null;
      var hash = "";
      pas["WEBLib.Controls"].TControl.BindEvents.call(this);
      if (document.readyState !== "loading") if (this.FOnDOMContentLoaded != null) this.FOnDOMContentLoaded(this);
      window.addEventListener("resize",this.FResizePtr);
      window.addEventListener("load",this.FLoadedPtr);
      window.addEventListener("DOMContentLoaded",this.FDOMContentLoadedPtr);
      document.addEventListener("scroll",this.FScrollPtr);
      window.addEventListener("unload",this.FUnloadPtr);
     .....

There is also another call which removes this.

    this.UnbindEvents = function () {
      pas["WEBLib.Controls"].TControl.UnbindEvents.call(this);
      if ((this.FLayer$1 != null) && (this.FPopupClose === 0)) this.FLayer$1.removeEventListener("click",this.FDoClickPtr);
      if (this.FResizeObserver != null) {
        this.FResizeObserver.disconnect();
      };
      window.removeEventListener("resize",this.FResizePtr);
      window.removeEventListener("load",this.FLoadedPtr);
      window.removeEventListener("DOMContentLoaded",this.FDOMContentLoadedPtr);
      document.removeEventListener("scroll",this.FScrollPtr);
      window.removeEventListener("unload",this.FUnloadPtr);
      .....

But just its presence is enough to trigger the Lighthouse warning, and maybe even the undesirable behavior that the warning is, well, warning us about. In any event, this seems to be generated by TMS WEB Core automatically. Perhaps it could be left out, or an option set somewhere to leave it out?

This is to give the developer the opportunity to execute any code when the browser window is about to be closed via the Form.UnLoad event.
A possible solution could be is to only attach the unload event handler when the form's OnLoad event is effectively used.
We will consider this.

That would be great! There's also the "browserUnload" event (and I see it is part of the Form as well) that can be used for the same sorts of things without triggering this particular Lighthouse issue.