Explorar o 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 %!s(int64=6) %!d(string=hai) anos
pai
achega
27f663e049
Modificáronse 1 ficheiros con 1 adicións e 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;