Giter Site home page Giter Site logo

Conditionally eager load about monolazy HOT 2 OPEN

s3ththompson avatar s3ththompson commented on August 12, 2024
Conditionally eager load

from monolazy.

Comments (2)

jongacnik avatar jongacnik commented on August 12, 2024

This is an interesting thought. I generally don't eager load. I don't really have a great reason not to, though I suppose seeing that moment when images pop in is something I've gotten used to so I haven't thought much about further optimizing for perceived faster loading. In some ways I kind of like that moment.

That said, am curious. If eager loading do you typically do some sort of sequencing? Like, on idle, begin loading images in the page sequentially?

from monolazy.

s3ththompson avatar s3ththompson commented on August 12, 2024

I really only do this in specific cases like a slideshow which is built around instantaneous switching among a number of images or something. (So I definitely would buy an argument that this is out-of-scope for a generic component.) I'm still experimenting with the best way to do this. Previously, on page (or component) load I've called something like this within an on-idle callback:

prefetch () {
  this.images.map(image => {
    image.buffer = html`<img src="${image.source}">`
  })
}

As an optimization, prefetch can run only if NetworkInformation returns a connection that seems like 4g or desktop or something.

I agree about slight delay in images appearing, as long as they're in intrinsically sized containers. In fact even with the above I usually add a slight fade-in animation.

from monolazy.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.