소스 검색

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 6 년 전
부모
커밋
27f663e049
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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;