WIP feat(core): Support optional timeout for idle deferred triggers#67190
Draft
SkyZeroZx wants to merge 1 commit intoangular:mainfrom
Draft
WIP feat(core): Support optional timeout for idle deferred triggers#67190SkyZeroZx wants to merge 1 commit intoangular:mainfrom
SkyZeroZx wants to merge 1 commit intoangular:mainfrom
Conversation
Allows specifying a timeout parameter for idle-based deferred triggers, enabling more granular control over when deferred actions are executed. Closes angular#67187
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
It's still a work in progress, however any comments/suggestions are welcome
This change allows supply a timeout value in the on idle trigger of an Angular
@deferblock, which translates into passing thetimeoutoption torequestIdleCallback.That way, if the browser doesn’t schedule the callback soon enough, the work will run no later than the specified timeout in options
Usage
@defer (on idle(500)) { <heavy-component /> } @defer (prefetch on idle(500)) { <heavy-component /> } @defer (hydrate on idle(500)) { <heavy-component /> }Other information
Another alternative is to allow an object as a configuration like the following (Similar like
@defer (on viewport(<options>))with intersection observer options )I'm not sure considering that currently there is only timeout as an option.
@defer (on idle({ timeout : 500 })) { <heavy-component /> }