Skip to content

Commit

Permalink
Merge pull request #1 from CapsureIt/upload-complete
Browse files Browse the repository at this point in the history
Add upload-complete event
  • Loading branch information
evanminto authored Oct 17, 2018
2 parents f5069b8 + 90ec55e commit cc5f8cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@capsureit/uppy-cloudinary",
"version": "0.1.3",
"version": "0.1.4",
"description": "Upload to Cloudinary with Uppy",
"main": "dist/common.js",
"jsnext:main": "dist/esm.js",
Expand Down
6 changes: 6 additions & 0 deletions src/CloudinaryPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default class CloudinaryPlugin extends Plugin {
return;
}

// Inform uppy that the upload has started
if (!uploadStarted) {
this.uppy.emit('upload-started', file);
uploadStarted = true;
Expand All @@ -70,6 +71,11 @@ export default class CloudinaryPlugin extends Plugin {
bytesUploaded: event.loaded,
bytesTotal: event.total
});

// Inform Uppy that the upload is finished
if (event.loaded >= event.total) {
this.uppy.emit('upload-complete', file);
}
}
});
};
Expand Down

0 comments on commit cc5f8cb

Please sign in to comment.