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

Defer execution of observer callbacks #278

Merged
merged 2 commits into from Nov 14, 2022
Merged

Conversation

philipwalton
Copy link
Member

This PR fixes #277 by deferring execution of all Performance Observer callbacks by a microtask, which will allow the current call stack to complete and ensure all module-scoped variables are available within the callback itself. This is needed to address an interop issue with Safari.

This PR also removes some related logic that was only needed to address compat issues in older versions of Safari. Since this logic is not needed in the last two major versions of Safari, it's safe to remove from this library.

src/lib/observe.ts Outdated Show resolved Hide resolved
src/onFCP.ts Show resolved Hide resolved
src/onFCP.ts Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PerformanceObserver is not disconnected after paint in Safari
2 participants