Просмотр исходного кода

Fix a couple uses of ".prototype = new"

We don't want the THREE.Loader constructor to be executed, we just want
to setup our prototype chain. Using new would execute the constructor
logic of THREE.Loader.
Elisée Maurer 11 лет назад
Родитель
Сommit
f523a58dc3
2 измененных файлов с 2 добавлено и 3 удалено
  1. 1 2
      examples/js/loaders/AWDLoader.js
  2. 1 1
      examples/js/loaders/gltf/glTFLoader.js

+ 1 - 2
examples/js/loaders/AWDLoader.js

@@ -116,8 +116,7 @@ THREE.AWDLoader = (function (){
   };
 
 
-  AWDLoader.prototype = new THREE.Loader();
-
+  AWDLoader.prototype = Object.create( THREE.Loader.prototype );
   AWDLoader.prototype.constructor = AWDLoader;
 
   AWDLoader.prototype.load = function ( url, callback ) {

+ 1 - 1
examples/js/loaders/gltf/glTFLoader.js

@@ -16,7 +16,7 @@ THREE.glTFLoader = function (showStatus) {
     THREE.Loader.call( this, showStatus );
 }
 
-THREE.glTFLoader.prototype = new THREE.Loader();
+THREE.glTFLoader.prototype = Object.create( THREE.Loader.prototype );
 THREE.glTFLoader.prototype.constructor = THREE.glTFLoader;
 
 THREE.glTFLoader.prototype.load = function( url, callback ) {

粤ICP备19079148号