Could we Have Async Loaders?

Hey!
So I think it would be really cool if we had async versions of loaders, instead of relying on callbacks. This way users could use .then() instead of feeding in a callback. This provides a lot more freedom when it comes to returning promises, etc. In specific I’m using the ColladaLoader, however this would apply to all loaders. Could this be done?

Thanks,
S41L0R

Most loaders have a loadAsync method, if they inherit from THREE.Loader. :slight_smile:

4 Likes

Oops, I don’t know the existence of loadAsync, have been using
await new Promise(resolve=>loader.load(url,geo=>resolve(geo))) before.
Thanks!

Thanks! All I had done is ctrl-f for async in the colladaLoader file, I completely forgot about inheriting.

var gltfLoader = new THREE.GLTFLoader();
var result = await gltfLoader.loadAsync("car/scene.gltf");
...