-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
Inconsistent return value type from FileLoader.load() #10712
Comments
I agree. Maybe we can always return |
Yep. Or returning nothing is another option. The reason why I didn't write we should return null/nothing |
Is anyone considering Promises for this type of thing? If loader.load() always returns a Promise that resolves the content, then it doesn't matter if the content comes from the cache object or an xml req. etc. http://caniuse.com/#feat=promises Support for Promises is very good already. |
Related filed issue #10644 Yeah, Promises is a good option but |
I think @makc was the one that suggested returning |
I did suggest that to have a way to abort downloads. If you had an abort() method somewhere, returned value would not matter |
Hm, so will we return |
that's only a part of the problem, since the reference is lost in many model loaders, iirc. I did #8099 for this, but it was sitting idle for too long, and I closed it because of merge conflicts. |
I think I would vote for returning |
Does |
Good point... |
And probably |
I think "abort all" in file loader could work if there was a way to make multiple end loaders use single file loader instance, but iirc there is no way. So it has to be in the manager |
Description of the problem
FileLoader.load()
returns three types of return value.XMLHttpRequest
instance when cache doesn't hit and url is not data: URIundefined
when url is data: URIAs for me it'd be kinda confusing to users because the return value type
depends on the cache state and url type.
Another confusing thing is it returns cached(loaded) data synchronously
before it calls
manager.itemEnd()
when cache hits.I like consistent design,
I want loaded/cached data only to be asynchronously passed to user via
onLoad
callback.So how about returning
null
when 2. and 3.?Or any other ideas?
Three.js version
Browser
OS
Hardware Requirements (graphics card, VR Device, ...)
The text was updated successfully, but these errors were encountered: