The event callback to call when a page unload event is triggered
Optional
excludeEvents: string[][Optional] An array of events that should not be hooked, unless no other events can be.
Optional
evtNamespace: string | string[][Optional] Namespace(s) to append to the event listeners so they can be uniquely identified and removed based on this namespace.
true - when at least one of the events was registered otherwise false
Listen to the 'beforeunload', 'unload' and 'pagehide' events which indicates a page unload is occurring, this does NOT listen to the 'visibilitychange' event as while it does indicate that the page is being hidden it does not necessarily mean that the page is being completely unloaded, it can mean that the user is just navigating to a different Tab and may come back (without unloading the page). As such you may also need to listen to the 'addPageHideEventListener' and 'addPageShowEventListener' events.