Skip to content

Commit a1fd921

Browse files
committed
Merge pull request #8 from deepdevelop/uploader_id
Generate unique id for uploader instance.
2 parents ca716ec + a5fa7c2 commit a1fd921

7 files changed

+15
-19
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "deep-uploader",
3-
"version": "0.1.0",
3+
"version": "0.1.2",
44
"homepage": "https://github.com/deepdevelop/DeepUploader",
55
"authors": [
66
"greatghoul <[email protected]>"

dist/deep-uploader.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,6 @@ FileTrigger.trigger = function (element, profile, callback) {
341341

342342
for (var i = 0; i < files.length; i++) {
343343
callback(files[i]);
344-
_eventTrigger2['default'].trigger(element, 'FileAdded', {
345-
element: element,
346-
profile: profile,
347-
file: files[i]
348-
});
349344
}
350345

351346
// Destroy the file input
@@ -383,15 +378,19 @@ var BaseUploader = (function () {
383378
function BaseUploader(element, profile, file) {
384379
_classCallCheck(this, BaseUploader);
385380

381+
this.id = _uuid2['default'].v4();
386382
this.element = element;
387383
this.profile = profile;
388384
this.file = file;
385+
386+
_eventTrigger2['default'].trigger(this.element, 'FileAdded', this._detail());
389387
}
390388

391389
_createClass(BaseUploader, [{
392390
key: '_detail',
393391
value: function _detail() {
394392
return {
393+
id: this.id,
395394
element: this.element,
396395
profile: this.profile,
397396
file: this.file,
@@ -407,9 +406,8 @@ var BaseUploader = (function () {
407406
month = month > 9 ? month : '0' + month;
408407

409408
var fileExt = this.file.name.split('.').pop() || 'tmp';
410-
var fileName = _uuid2['default'].v4();
411409

412-
return year + '/' + month + '/' + fileName + '.' + fileExt;
410+
return year + '/' + month + '/' + this.id + '.' + fileExt;
413411
}
414412
}, {
415413
key: 'start',

dist/deep-uploader.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)