Skip to content

Commit

Permalink
fix(mux-uploader): Fix attempt and chunkSuccess event details not bei…
Browse files Browse the repository at this point in the history
…ng passed. Also make the data passed consistent by using event for all params.
  • Loading branch information
clearlyTHUYDOAN committed Jul 25, 2022
1 parent a34feaa commit 09d4cf8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/mux-uploader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,15 @@ class MuxUploaderElement extends HTMLElement {
file: evt.detail,
});

upload.on('attempt', ({ detail }) => {
this.dispatchEvent(new CustomEvent('attempt', detail));
upload.on('attempt', (event) => {
this.dispatchEvent(new CustomEvent('chunkAttempt', event));
});

upload.on('chunkSuccess', ({ detail }) => {
this.dispatchEvent(new CustomEvent('chunkSuccess', detail));
upload.on('chunkSuccess', (event) => {
this.dispatchEvent(new CustomEvent('chunkSuccess', event));
});

upload.on('error', (err) => {
upload.on('error', (event) => {
const errorMessage = 'An error has occurred';

this.setAttribute('upload-error', '');
Expand All @@ -460,13 +460,13 @@ class MuxUploaderElement extends HTMLElement {
this.statusMessage.innerHTML = errorMessage;
}

console.error(err.detail.message);
this.dispatchEvent(new CustomEvent('error', err));
console.error(event.detail.message);
this.dispatchEvent(new CustomEvent('error', event));
});

upload.on('progress', (progress) => {
this.setProgress(progress.detail);
this.dispatchEvent(new CustomEvent('progress', progress));
upload.on('progress', (event) => {
this.setProgress(event.detail);
this.dispatchEvent(new CustomEvent('progress', event));
});

upload.on('success', (event) => {
Expand Down

0 comments on commit 09d4cf8

Please sign in to comment.