提交 cc1be0ef 编写于 作者: K Kai Salmen

Simplified private _onError callback

上级 29bff17b
...@@ -10,8 +10,8 @@ const OBJLoader2Parser = function () { ...@@ -10,8 +10,8 @@ const OBJLoader2Parser = function () {
let scope = this; let scope = this;
this.callbacks = { this.callbacks = {
onProgress: function ( type, text, numericalValue ) { onProgress: function ( text ) {
scope._onProgress( type, text, numericalValue ) scope._onProgress( text )
}, },
onAssetAvailable: function ( payload ) { onAssetAvailable: function ( payload ) {
scope._onAssetAvailable( payload ) scope._onAssetAvailable( payload )
...@@ -217,26 +217,14 @@ OBJLoader2Parser.prototype = { ...@@ -217,26 +217,14 @@ OBJLoader2Parser.prototype = {
}, },
/** /**
* Announce feedback which is give to the registered callbacks. * Announce parse progress feedback which is logged to the console.
* @private * @private
* *
* @param {string} type The type of event
* @param {string} text Textual description of the event * @param {string} text Textual description of the event
* @param {number} numericalValue Numerical value describing the progress
*/ */
_onProgress: function ( type, text, numericalValue ) { _onProgress: function ( text ) {
let message = text ? text : ''; let message = text ? text : '';
let event = {
detail: {
type: type,
modelName: this.modelName,
instanceNo: this.instanceNo,
text: message,
numericalValue: numericalValue
}
};
if ( this.logging.enabled && this.logging.debug ) { if ( this.logging.enabled && this.logging.debug ) {
console.log( message ); console.log( message );
...@@ -246,7 +234,7 @@ OBJLoader2Parser.prototype = { ...@@ -246,7 +234,7 @@ OBJLoader2Parser.prototype = {
}, },
/** /**
* Announce error feedback which is given to the generic error handler to the registered callbacks. * Announce error feedback which is logged as error message.
* @private * @private
* *
* @param {String} errorMessage The event containing the error * @param {String} errorMessage The event containing the error
...@@ -825,8 +813,8 @@ OBJLoader2Parser.prototype = { ...@@ -825,8 +813,8 @@ OBJLoader2Parser.prototype = {
this._buildMesh( result ); this._buildMesh( result );
let progressBytesPercent = this.globalCounts.currentByte / this.globalCounts.totalBytes; let progressBytesPercent = this.globalCounts.currentByte / this.globalCounts.totalBytes;
this._onProgress( 'progressParse', 'Completed [o: ' + this.rawMesh.objectName + ' g:' + this.rawMesh.groupName + '' + this._onProgress( 'Completed [o: ' + this.rawMesh.objectName + ' g:' + this.rawMesh.groupName + '' +
'] Total progress: ' + ( progressBytesPercent * 100 ).toFixed( 2 ) + '%', progressBytesPercent ); '] Total progress: ' + ( progressBytesPercent * 100 ).toFixed( 2 ) + '%' );
this._resetRawMesh(); this._resetRawMesh();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册