Explorar el Código

Made the onLoad param a callback generic

Turned the onLoad parameter of the ObjectLoader.load function a generic type of Object3D so users can define which kind of object they are loaded so it stays typed.
Jeffrey Lanters hace 6 años
padre
commit
27f663e049
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      src/loaders/ObjectLoader.d.ts

+ 1 - 1
src/loaders/ObjectLoader.d.ts

@@ -13,7 +13,7 @@ export class ObjectLoader {
 
   load(
     url: string,
-    onLoad?: (object: Object3D) => void,
+    onLoad?: <ObjectType extends Object3D>(object: ObjectType) => void,
     onProgress?: (event: ProgressEvent) => void,
     onError?: (event: Error | ErrorEvent) => void
   ): void;