Closed dennemark closed 2 years ago
Thanks @dennemark . I have not seen that syntax for typings before onSuccess?: MeshAssetTask['onSuccess']
instead of onSuccess?: (task: TextureAssetTask) => void
- does that match the call signature over? I suppose I can look in the typings declaration, but curious what that is called or maybe I just need a coffee! 😄
I forgot the onError callback... added it now. 🙄
onSuccess?: MeshAssetTask['onSuccess']
is the same as onSuccess?: (task: TextureAssetTask) => void
It just takes the type of the original function, so it would also adapt to changes. Typescript seems to handle Types a bit similar to objects in this sense, but MeshAssetTask.onSuccess
does not work as far as I know. I thought its more convenient than figuring out, the exact function of the original MeshAssetTask :D
Thanks @dennemark - I haven't dropped a NPM in a while - still working on the docs. Let me know if you need this out in the wild!
@brianzinn no rush. Managed to work around it for the current project. But am looking forward to the new version. Synchronising with bjs5 release? ;)
That for sure, but redoing the docs. I need to get busy as v5 is imminent... I've already run 5.0 migrations though - actually 5.0 should work on current version - I pushed a bunch of backwards compatibility changes, so it was working at one point in alpha builds at least - then it broke in the betas and then it was working again!! Hope it stays working :) Also, some stuff will work properly in v5 such as gizmos, etc.
related to https://github.com/brianzinn/react-babylonjs/issues/129
allows to assign onError and onSuccess callbacks to tasks via
useAssetManager( [ { taskType [...] onSuccess: (task) => { console.log(task.isCompleted) } } ] )