瀏覽代碼

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;