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

Lazy-loading assets #3816

Closed
VinnyVicious opened this issue Sep 24, 2015 · 2 comments
Closed

Lazy-loading assets #3816

VinnyVicious opened this issue Sep 24, 2015 · 2 comments
Labels

Comments

@VinnyVicious
Copy link

I'm using (https://icculus.org/physfs/)[PhysicsFS] in a project that i'm compiling with Emscripten and i'm curious about lazy-loading assets. Has anyone worked with this kind of asset loading? I mean, maybe i can write some JS code that will load the files into the virtual filesystem of the project, allowing the user to cache the project code, but not the assets. Right now, if i change an asset, i have to recompile everything and then clear the cache.

@cwoffenden
Copy link
Contributor

I did lazy-loading for a previous project. From a high-level it went something like:

  • implement the notion of a virtual file system, mapping an MEMFS mount point to base URL
  • for each file request, check whether it already exits in the MEMFS, if it does return it
  • if it doesn't exist create a emscripten_async_wget request, storing the result in the MEMFS, with a completion callback

That's simplifying it, since behind the scenes the preloader would wait until all associated assets were loaded (and was able to load, say, *.txt from a given root by having serialised directory listings). In use it works quite well, with assets being cached by the browser for the next load.

@stale
Copy link

stale bot commented Aug 31, 2019

This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Aug 31, 2019
@stale stale bot closed this as completed Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants