Conversation
…eparated list of tag names which would be replaced in the inject response. This way you can allow to inject script tags.
…ey are executed. Otherwise they're not run nor is the script src downloaded.
Optionally allow to lazy load patterns, which will only be imported and initialized when they are visible, via an intersection observer. Needs special pattern registration.
Support for lazy initialization of Patterns. The import is done eagerly, but the initialization only when an intersection observer detects that a pattern is being shown.
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.
This is an experiment for lazy loading patterns.
There are two approaches evaluated in this PR:
Registry with lazy loading support: Instead of importing all the patterns in the bundle, a special configuration will be passed to the registry.init method. This contains the patterns name, the patterns trigger and a importer function.
This works fine and all tests pass, but the drawback with this method is that the pattern name and trigger need to be known before importing the pattern. This leads to duplicate information.
An intersection observer is importing the pattern module and initializing it, once the pattern becomes visible.
Lazy initialization as an alternative. An intersection observer is initializing an already imported pattern module, once the pattern becomes visible.
The first approach would probably give us the biggest benefit. But we need to find a better solution for the problem of needing to know the trigger and name before importing the module.