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

Consider dropping eh-hotspots.json #5

Open
marcoow opened this issue Nov 26, 2020 · 0 comments
Open

Consider dropping eh-hotspots.json #5

marcoow opened this issue Nov 26, 2020 · 0 comments

Comments

@marcoow
Copy link
Member

marcoow commented Nov 26, 2020

I think it should be possible to drop the extra eh-hotspots.json file (and all of the build time tasks this addon performs really).

Using https://github.com/adopted-ember-addons/ember-cli-ifa you'd have access to the list of images at runtime so you could get the list of relevant image files from that instead of from disk at build time.

Using a service worker it would be possible to preload the images without injecting <link rel="preload"> tags at build time (and without the performance implications that has). The ef-hotspots service could then load all of the images (which would be immediate since they have been preloaded into the service worker already) and collect the dimensions in its load method (that method should likely be an ember-concurrency task btw – currently it's possible to end up with multiple parallel fetches for /assets/eh-hotspots.json and that's maybe even likely to happen since the eh-background component calls the method in its constructor so rendering two such components on the same route should likely trigger 2 concurrent requests).

Overall I think this would allow for simplifying this addon quite a bit while improving the solution at the same time.

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

No branches or pull requests

1 participant