-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add an optional request URL mapping function to WASM asset io #21737
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
base: main
Are you sure you want to change the base?
Add an optional request URL mapping function to WASM asset io #21737
Conversation
612daa8 to
00ede2d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, I need something like this for work.
Having a builtin cache busting solution would be great down the line, but that might be complicated/controversial, and this will allow experimenting in third party plugins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm this feels hyper specific and overly generic lol.
What do you think about making this a new asset source instead? This would be like PathMappingAssetSource and it would be able to apply to any asset source instead of just web assets. The disadvantage is you need to support going to and from the path to handle asset events.
Edit: to clarify this would be a wrapper asset source so it would be generic over the inner asset source.
|
That might be smarter yeah, I'll try it out. |
|
I can't really figure out a way to sensibly make the mapping happen at the It seems pretty easy to make a wrapper for an |
Objective
Allow post processing wasm asset request URLs to make it possible to add query strings.
Solution
The first steps to fixing #21730
Add a new property
request_mappertoHttpWasmAssetReader. I made itdynto not add needless generics, but I guess static dispatch might work too.Some mapping could be added to the default asset loader too, but I figured there is no consensus on what to do there. I just wanted to add this to allow motivated users to implement some kind of cache busting manually.
Testing
Added this to the
custom_asset_readerexample and ran it on a web browser.The alternative, more straight forward, and slightly less efficient way to do cache busting would be to just add the current game version to the query string. Maybe we could add a premade helper function for that.
Showcase