-
-
Notifications
You must be signed in to change notification settings - Fork 204
feat(cdk): add native postTask
scheduling support
#1672
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
base: main
Are you sure you want to change the base?
Conversation
@@ -126,6 +169,39 @@ function scheduleOnQueue<T>( | ||
) | ||
); | ||
} | ||
function scheduleOnPostTaskQueue<T>( | ||
work: (...args: any[]) => void, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering,
I've noticed the usage on any
in many libraries, whilst Sonarqube scans recommend to replace any
with unknown
where possible. Sometimes it causes too strict typing and any
could be preferred.
When I have a first look at this code, it seems that any
could be replaced here with unknown
. I'm not saying it's wrong however I wonder how serious this rule should be taken.
What is your opinion on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, unknown
is better than any
. This would in best case be done as part of this effort: #976 :)
This pull request introduces an initial, albeit naive, implementation of the
scheduler.postTask
native scheduling API. The primary goal is to gather feedback before further refinement.Drawback of Custom Schedulers
The pull request addresses the limitation associated with custom schedulers. While it's feasible to create a custom scheduler to prioritize tasks within your controlled codebase, third-party scripts may not utilize the same scheduler. Consequently, prioritizing work becomes challenging in environments where you don't have control over all the code on the page. The alternatives are limited to chunking up tasks or explicitly yielding to user interactions. The new implementation aims to overcome these drawbacks by leveraging the native
scheduler.postTask
API.Further Work