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

handle case when setImmediate is not available in the browser #2728

Conversation

flyingart
Copy link

Description

I found some cases, when setImmediate is not available (f.ex in Coherent browser). This "workaround" seems to solve the issue. I didn't find more places where similar tweak is needed.

Test plan

Make sure that everything works like before.

I found some cases, when setImmediate is not available (f.ex in Coherent browser). This "workaround" seems to solve the issue.
@m-bert
Copy link
Contributor

m-bert commented Feb 5, 2024

Hi @flyingart! Thanks for this PR!

Coherent browser

Do you mean Coherent GT? I have to admit that I'm not familiar with this one.

I didn't find more places where similar tweak is needed

This change should be sufficient, as all other calls for queueMicrotask/setImmediate use ghQueueMicrotask wrapper.

@j-piasecki
Copy link
Member

This file was updated to use also requestAnimationFrame, I'll close the PR for now. If this doesn't solve your case, let me know.

export const ghQueueMicrotask =
typeof setImmediate === 'function'
? setImmediate.bind(null)
: typeof requestAnimationFrame === 'function'
? requestAnimationFrame.bind(null)
: queueMicrotask.bind(null);

@j-piasecki j-piasecki closed this Oct 15, 2024
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.

3 participants