Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to optionally configure the events used for detecting and handling when page unload and flushing occurs #1683 #1684

Merged
merged 2 commits into from
Oct 7, 2021

Conversation

MSNev
Copy link
Collaborator

@MSNev MSNev commented Oct 5, 2021

No description provided.

… handling when page unload and flushing occurs #1683
Comment on lines +71 to +74
if (!added && excluded.length > 0) {
// Failed to add any listeners and we excluded some, so just attempt to add the excluded events
added = addEventListeners(excluded, listener);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curios, why are we doing this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We attempt to "listen" to any and all unload / show events, however, if the config provides a list of events that would "exclude" events (based on the current runtime environment (browser)) then we would end up listening to nothing.

So the "exclude" events is treated as a best effort.

  • If at least one event can be hooked (excluding the requested), then we are happy and continue
  • If no event can be hooked (because they all got excluded or the environment doesn't support then), then we try and hook all of the original events (including the requested excluded set)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants