Skip to content

Commit

Permalink
fix: fix on-error event and add on-progress event(hujiulong#15).
Browse files Browse the repository at this point in the history
  • Loading branch information
hujiulong committed Nov 18, 2017
1 parent faa09e1 commit 0a92d7b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.0",
"css-loader": "^0.28.0",
"cz-conventional-changelog": "^2.1.0",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/model-gltf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export default {
this.$emit( 'on-load' );
}, xhr => {
this.$emit( 'on-progress', xhr );
}, err => {
this.$emit( 'on-error', err );
Expand Down
4 changes: 4 additions & 0 deletions src/model-mixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@ export default {
this.$emit( 'on-load' );
}, xhr => {
this.$emit( 'on-progress', xhr );
}, err => {
this.$emit( 'on-error', err );
Expand Down
12 changes: 9 additions & 3 deletions src/model-obj.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ export default {
}
const onProgress = xhr => {
this.$emit( 'on-progress', xhr );
}
const onError = err => {
this.$emit( 'on-error', err );
Expand Down Expand Up @@ -116,13 +122,13 @@ export default {
this.loader.setMaterials( materials );
this.loader.load( this.src, onLoad, onError );
this.loader.load( this.src, onLoad, onProgress, onError );
}, onError );
}, () => {}, onError );
} else {
this.loader.load( this.src, onLoad, onError );
this.loader.load( this.src, onLoad, onProgress, onError );
}
Expand Down
4 changes: 4 additions & 0 deletions src/model-sea3d.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export default {
this.$emit( 'on-load' );
}, xhr => {
this.$emit( 'on-progress', xhr );
}, err => {
console.log( err )
Expand Down

0 comments on commit 0a92d7b

Please sign in to comment.