Pārlūkot izejas kodu

Merge pull request #13469 from aardgoose/callback-on-prototype-2

move empty callbacks to prototype
Mr.doob 7 gadi atpakaļ
vecāks
revīzija
f2ab402a4a
2 mainītis faili ar 9 papildinājumiem un 9 dzēšanām
  1. 2 2
      src/core/InterleavedBuffer.js
  2. 7 7
      src/loaders/Loader.js

+ 2 - 2
src/core/InterleavedBuffer.js

@@ -12,8 +12,6 @@ function InterleavedBuffer( array, stride ) {
 	this.dynamic = false;
 	this.updateRange = { offset: 0, count: - 1 };
 
-	this.onUploadCallback = function () {};
-
 	this.version = 0;
 
 }
@@ -32,6 +30,8 @@ Object.assign( InterleavedBuffer.prototype, {
 
 	isInterleavedBuffer: true,
 
+	onUploadCallback: function () {},
+
 	setArray: function ( array ) {
 
 		if ( Array.isArray( array ) ) {

+ 7 - 7
src/loaders/Loader.js

@@ -24,13 +24,7 @@ import { Color } from '../math/Color.js';
  * @author alteredq / http://alteredqualia.com/
  */
 
-function Loader() {
-
-	this.onLoadStart = function () {};
-	this.onLoadProgress = function () {};
-	this.onLoadComplete = function () {};
-
-}
+function Loader() {}
 
 Loader.Handlers = {
 
@@ -69,6 +63,12 @@ Object.assign( Loader.prototype, {
 
 	crossOrigin: undefined,
 
+	onLoadStart: function () {},
+
+	onLoadProgress: function () {},
+
+	onLoadComplete: function () {},
+
 	initMaterials: function ( materials, texturePath, crossOrigin ) {
 
 		var array = [];